|
From: Jimmy C. <ji...@te...> - 2003-10-28 00:34:50
|
Hi,
I followed the example of implementing the wrapperListener interface. I
tested it first in console mode and experienced no problem (The wrapper
created the instance, started it, and finally stopped it). Then I
registered it as service using -i flag and started it using the -t flag.
But when I started the service, it gave me the error message of:
wrapper | Starting the Jimmy Chu Sample Application service...
wrapper | The Jimmy Chu Sample Application service was launched, but
failed to
start.
Any help is greatly appreciated!
My sample app. is as followed:
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D myApp.java =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
import org.tanukisoftware.wrapper.WrapperManager;
import org.tanukisoftware.wrapper.WrapperListener;
public class myApp implements WrapperListener {
=09
public myApp() {
System.out.println("Creating me...");
}
=09
public Integer start( String[] args ) {
System.out.println("I am starting");
return null;
}
=09
public int stop( int exitCode ) {
System.out.println("I am stopping");
return exitCode;
}
public void controlEvent( int event )
{
if (WrapperManager.isControlledByNativeWrapper()) {
// The Wrapper will take care of this event
} else {
// We are not being controlled by the Wrapper, so
// handle the event ourselves.
if ((event =3D=3D WrapperManager.WRAPPER_CTRL_C_EVENT) ||
(event =3D=3D WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) =
||
(event =3D=3D =
WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)){
WrapperManager.stop(0);
}
}
}
public static void main(String[] args) {
WrapperManager.start( new myApp(), args);
}
}
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dwrapper.conf=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
wrapper.java.command=3D%JAVA_HOME%/bin/java
wrapper.java.mainclass=3DmyApp
wrapper.java.classpath.1=3D./wrapper.jar
wrapper.java.classpath.2=3D.
wrapper.java.library.path.1=3D%JWrapperPath%/lib
wrapper.java.initmemory=3D3
wrapper.java.maxmemory=3D64
wrapper.ntservice.name=3DTESTINGMYAPP
wrapper.ntservice.displayname=3DJimmy Chu Sample Application
wrapper.ntservice.description=3DJimmy Chu Service Description
Jimmy Chu
|