|
From: Leif M. <lei...@ta...> - 2009-03-17 11:41:07
|
Elias, Ok. Now the problem is that when your WrapperListener.start method returns, there are not any non-daemon threads running. Because of this, the JVM, not the Wrapper is initiating its own shutdown. The Wrapper's shutdown is initiated when its own Shutdown Hook is started by the JVM. Please make sure that you have started at least one non-daemon thread. Java will shutdown when run without the Wrapper as well if the main method completes and there are no non-daemon threads running. Let me know if this doesn't make sense. Cheers, Leif On Tue, Mar 17, 2009 at 7:42 PM, ejml <eli...@gm...> wrote: > > Thanks Leif by your response. > Yes, I'm making use of Method 3 and your had reason. I had my variable > initialized to 0. I have corrected this issue, but it doesn't works yet. My > log says this: > > DEBUG | wrapper | 2009/03/17 11:38:41 | Allocating a console for the > service. > DEBUG | wrapper | 2009/03/17 11:38:41 | Found console window. > STATUS | wrapper | 2009/03/17 11:38:41 | --> Wrapper Started as Service > STATUS | wrapper | 2009/03/17 11:38:41 | Java Service Wrapper Community > Edition 3.3.3 > STATUS | wrapper | 2009/03/17 11:38:41 | Copyright (C) 1999-2009 Tanuki > Software, Ltd. All Rights Reserved. > STATUS | wrapper | 2009/03/17 11:38:41 | > http://wrapper.tanukisoftware.org > STATUS | wrapper | 2009/03/17 11:38:41 | > DEBUG | wrapper | 2009/03/17 11:38:41 | Using tick timer. > DEBUG | wrapperp | 2009/03/17 11:38:41 | server listening on port 32000. > DEBUG | wrapper | 2009/03/17 11:38:41 | Ping settings: > wrapper.ping.interval=5, wrapper.ping.interval.logged=1, > wrapper.ping.timeout=30 > STATUS | wrapper | 2009/03/17 11:38:41 | Launching a JVM... > DEBUG | wrapper | 2009/03/17 11:38:41 | command: > "C:\WINNT\system32\java.exe" -Djava.library.path="../lib" -classpath > "../bin/AXConnectorServer.jar;../lib/wrappertest.jar;../lib/wrapper.jar" > -Dwrapper.key="YaKrFRBk8gEnOuzE" -Dwrapper.port=32000 > -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 > -Dwrapper.debug="TRUE" -Dwrapper.pid=3516 -Dwrapper.version="3.3.3" > -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" > -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 > com.gvs.AXConnectorServer.AXConnectorServiceWin32 > DEBUG | wrapper | 2009/03/17 11:38:41 | JVM started (PID=4892) > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > WrapperManager class initialized by thread: main Using classloader: > sun.misc.Launcher$AppClassLoader@11b86e7 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager: Initializing... > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: JVM #1 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Running a > 32-bit JVM. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Registering > shutdown hook > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Using > wrapper > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Load native > library. One or more attempts may fail if platform specific libraries do > not exist. This is NORMAL and is only a problem if they all fail. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Unable to > load native library: wrapper-windows-x86-32.dll Cause: no > wrapper-windows-x86-32 in java.library.path > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Loaded > native library: wrapper.dll > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Calling > native initialization method. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperJNI Debug: Initializing > WrapperManager native library. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperJNI Debug: Java Executable: > C:\WINNT\system32\java.exe > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperJNI Debug: Windows version: > 5.0.2195 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Java Version > : 1.6.0_11-b03 Java HotSpot(TM) Client VM > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Java VM > Vendor : Sun Microsystems Inc. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: OS Name > : Windows 2000 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: OS Arch > : x86 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Control > event monitor thread started. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > WrapperManager.start(com.gvs.AXConnectorServer.AXConnectorServiceWin32@201f9, > args[]) called by thread: main > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Startup > runner thread started. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > Communications runner thread started. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Open socket > to wrapper...Wrapper-Connection > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Opened > Socket from 31000 to 32000 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Send a > packet KEY : YaKrFRBk8gEnOuzE > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > handleSocket(Socket[addr=/127.0.0.1,port=32000,localport=31000]) > DEBUG | wrapperp | 2009/03/17 11:38:42 | accepted a socket from 127.0.0.1 > on port 31000 > DEBUG | wrapperp | 2009/03/17 11:38:42 | read a packet KEY : > YaKrFRBk8gEnOuzE > DEBUG | wrapper | 2009/03/17 11:38:42 | Got key from JVM: YaKrFRBk8gEnOuzE > DEBUG | wrapperp | 2009/03/17 11:38:42 | send a packet LOW_LOG_LEVEL : 1 > DEBUG | wrapperp | 2009/03/17 11:38:42 | send a packet PING_TIMEOUT : 30 > DEBUG | wrapperp | 2009/03/17 11:38:42 | send a packet PROPERTIES : > (Property Values) > DEBUG | wrapper | 2009/03/17 11:38:42 | Start Application. > DEBUG | wrapperp | 2009/03/17 11:38:42 | send a packet START : start > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Received a > packet LOW_LOG_LEVEL : 1 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: LowLogLevel > from Wrapper is 1 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Received a > packet PING_TIMEOUT : 30 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: PingTimeout > from Wrapper is 30000 > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Received a > packet PROPERTIES : (Property Values) > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Received a > packet START : start > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: calling > WrapperListener.start() > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > WrapperListener.start runner thread started. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: returned > from WrapperListener.start() > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Send a > packet STARTED : > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > WrapperListener.start runner thread stopped. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Startup > runner thread stopped. > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: ShutdownHook > started > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: > WrapperManager.stop(0) called by thread: Wrapper-Shutdown-Hook > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Send a > packet STOP : 0 > DEBUG | wrapperp | 2009/03/17 11:38:42 | read a packet STARTED : > DEBUG | wrapper | 2009/03/17 11:38:42 | JVM signalled that it was started. > DEBUG | wrapperp | 2009/03/17 11:38:42 | read a packet STOP : 0 > DEBUG | wrapper | 2009/03/17 11:38:42 | JVM requested a shutdown. (0) > DEBUG | wrapper | 2009/03/17 11:38:42 | wrapperStopProcess(0) called. > DEBUG | wrapper | 2009/03/17 11:38:42 | Sending stop signal to JVM > DEBUG | wrapperp | 2009/03/17 11:38:42 | send a packet STOP : NULL > INFO | jvm 1 | 2009/03/17 11:38:42 | WrapperManager Debug: Received a > packet STOP : > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: Thread, > Wrapper-Shutdown-Hook, handling the shutdown process. > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: calling > listener.stop() > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: returned > from listener.stop() -> 0 > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: > shutdownJVM(0) Thread:Wrapper-Shutdown-Hook > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: wait for 0 > shutdown locs to be released. > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: Send a > packet STOPPED : 0 > DEBUG | wrapperp | 2009/03/17 11:38:43 | read a packet STOPPED : 0 > DEBUG | wrapper | 2009/03/17 11:38:43 | JVM signalled that it was stopped. > INFO | jvm 1 | 2009/03/17 11:38:43 | WrapperManager Debug: Closing > socket. > DEBUG | wrapperp | 2009/03/17 11:38:43 | socket read no code (closed?). > DEBUG | wrapperp | 2009/03/17 11:38:43 | socket not open, so packet not > sent SERVICE_CONTROL_CODE : 4 > DEBUG | wrapper | 2009/03/17 11:38:43 | SERVICE_CONTROL_INTERROGATE > INFO | jvm 1 | 2009/03/17 11:38:44 | WrapperManager Debug: Server > daemon shut down > INFO | jvm 1 | 2009/03/17 11:38:44 | WrapperManager Debug: ShutdownHook > complete > DEBUG | wrapper | 2009/03/17 11:38:44 | JVM process exited with a code of > 0, leaving the wrapper exit code set to 0. > DEBUG | wrapper | 2009/03/17 11:38:44 | JVM exited normally. > STATUS | wrapper | 2009/03/17 11:38:44 | <-- Wrapper Stopped > > Very thanks by your help. > > Greetings!!. > > > > > > Leif Mortenson-3 wrote: >> >> Elias, >>>From the java command line, it looks like you are making use of >> Integration Method #3 for your application. >> Is the com.gvs.AXConnectorServer.AXConnectorServiceWin32 class >> something that you created? It appears to be working pretty much >> correctly. >> The problem is that your WrapperListener.start implementation is >> returning an exit code of 0. This is telling the Wrapper that the JVM >> should exit with exit code 0. If the application is meant to continue >> running then the WrapperListener.start method should be returning >> null. >> >> See the Java docs for the WrapperListener class for more information: >> http://wrapper.tanukisoftware.org/doc/english/javadocs.html >> >> This is also described on the following page: >> http://wrapper.tanukisoftware.org/doc/english/integrate-listener.html >> >> Cheers, >> Leif >> >> On Tue, Mar 17, 2009 at 6:41 PM, ejml <eli...@gm...> wrote: >>> >>> Hello Folks!, >>> >>> I'm trying to use Java Service Wrapper to implement my java project like >>> windows service. My Project is made with Spring using Jetty. In other >>> words, >>> I use spring to startup jetty. This setup in eclipse work fine but I try >>> to >>> configure my application with Java Service Wrapper I get the next: >>> >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Allocating a console for the >>> service. >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Found console window. >>> STATUS | wrapper | 2009/03/17 09:40:35 | --> Wrapper Started as Service >>> STATUS | wrapper | 2009/03/17 09:40:35 | Java Service Wrapper Community >>> Edition 3.3.3 >>> STATUS | wrapper | 2009/03/17 09:40:35 | Copyright (C) 1999-2009 >>> Tanuki >>> Software, Ltd. All Rights Reserved. >>> STATUS | wrapper | 2009/03/17 09:40:35 | >>> http://wrapper.tanukisoftware.org >>> STATUS | wrapper | 2009/03/17 09:40:35 | >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Using tick timer. >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | server listening on port 32000. >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Ping settings: >>> wrapper.ping.interval=5, wrapper.ping.interval.logged=1, >>> wrapper.ping.timeout=30 >>> STATUS | wrapper | 2009/03/17 09:40:35 | Launching a JVM... >>> DEBUG | wrapper | 2009/03/17 09:40:35 | command: >>> "C:\WINNT\system32\java.exe" -Djava.library.path="../lib" -classpath >>> "../bin/AXConnectorServer.jar;../lib/wrappertest.jar;../lib/wrapper.jar" >>> -Dwrapper.key="fREO9IxlyMDSknzk" -Dwrapper.port=32000 >>> -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 >>> -Dwrapper.debug="TRUE" -Dwrapper.pid=4020 -Dwrapper.version="3.3.3" >>> -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" >>> -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 >>> com.gvs.AXConnectorServer.AXConnectorServiceWin32 >>> DEBUG | wrapper | 2009/03/17 09:40:35 | JVM started (PID=3756) >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> WrapperManager class initialized by thread: main Using classloader: >>> sun.misc.Launcher$AppClassLoader@11b86e7 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager: Initializing... >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: JVM #1 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Running a >>> 32-bit JVM. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> Registering >>> shutdown hook >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Using >>> wrapper >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Load >>> native >>> library. One or more attempts may fail if platform specific libraries do >>> not exist. This is NORMAL and is only a problem if they all fail. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Unable >>> to >>> load native library: wrapper-windows-x86-32.dll Cause: no >>> wrapper-windows-x86-32 in java.library.path >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Loaded >>> native library: wrapper.dll >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Calling >>> native initialization method. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperJNI Debug: Initializing >>> WrapperManager native library. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperJNI Debug: Java >>> Executable: >>> C:\WINNT\system32\java.exe >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperJNI Debug: Windows >>> version: >>> 5.0.2195 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Java >>> Version >>> : 1.6.0_11-b03 Java HotSpot(TM) Client VM >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Java VM >>> Vendor : Sun Microsystems Inc. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: OS Name >>> : Windows 2000 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: OS Arch >>> : x86 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> WrapperManager.start(com.gvs.AXConnectorServer.AXConnectorServiceWin32@201f9, >>> args[]) called by thread: main >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Startup >>> runner thread started. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Control >>> event monitor thread started. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> Communications runner thread started. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Open >>> socket >>> to wrapper...Wrapper-Connection >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Failed >>> attempt to bind using local port 31000 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Opened >>> Socket from 31001 to 32000 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Send a >>> packet KEY : fREO9IxlyMDSknzk >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> handleSocket(Socket[addr=/127.0.0.1,port=32000,localport=31001]) >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | accepted a socket from >>> 127.0.0.1 >>> on port 31001 >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | read a packet KEY : >>> fREO9IxlyMDSknzk >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Got key from JVM: >>> fREO9IxlyMDSknzk >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | send a packet LOW_LOG_LEVEL : 1 >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | send a packet PING_TIMEOUT : 30 >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | send a packet PROPERTIES : >>> (Property Values) >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Start Application. >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | send a packet START : start >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Received >>> a >>> packet LOW_LOG_LEVEL : 1 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> LowLogLevel >>> from Wrapper is 1 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Received >>> a >>> packet PING_TIMEOUT : 30 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> PingTimeout >>> from Wrapper is 30000 >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Received >>> a >>> packet PROPERTIES : (Property Values) >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Received >>> a >>> packet START : start >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: calling >>> WrapperListener.start() >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> WrapperListener.start runner thread started. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: returned >>> from WrapperListener.start() >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> WrapperListener.start() returned an exit code of 0. >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: >>> WrapperManager.stop(0) called by thread: WrapperListener_start_runner >>> INFO | jvm 1 | 2009/03/17 09:40:35 | WrapperManager Debug: Send a >>> packet STOP : 0 >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | read a packet STOP : 0 >>> DEBUG | wrapper | 2009/03/17 09:40:35 | JVM requested a shutdown. (0) >>> DEBUG | wrapper | 2009/03/17 09:40:35 | wrapperStopProcess(0) called. >>> DEBUG | wrapper | 2009/03/17 09:40:35 | Sending stop signal to JVM >>> DEBUG | wrapperp | 2009/03/17 09:40:35 | send a packet STOP : NULL >>> INFO | jvm 1 | 2009/03/17 09:40:36 | WrapperManager Debug: Received >>> a >>> packet STOP : >>> INFO | jvm 1 | 2009/03/17 09:40:36 | WrapperManager Debug: Thread, >>> WrapperListener_start_runner, handling the shutdown process. >>> INFO | jvm 1 | 2009/03/17 09:40:36 | WrapperManager Debug: >>> shutdownJVM(0) Thread:WrapperListener_start_runner >>> INFO | jvm 1 | 2009/03/17 09:40:36 | WrapperManager Debug: wait for >>> 0 >>> shutdown locs to be released. >>> INFO | jvm 1 | 2009/03/17 09:40:36 | WrapperManager Debug: Send a >>> packet STOPPED : 0 >>> DEBUG | wrapperp | 2009/03/17 09:40:36 | read a packet STOPPED : 0 >>> DEBUG | wrapper | 2009/03/17 09:40:36 | JVM signalled that it was >>> stopped. >>> INFO | jvm 1 | 2009/03/17 09:40:37 | WrapperManager Debug: Closing >>> socket. >>> DEBUG | wrapperp | 2009/03/17 09:40:37 | socket read no code (closed?). >>> INFO | jvm 1 | 2009/03/17 09:40:37 | WrapperManager Debug: calling >>> System.exit(0) >>> INFO | jvm 1 | 2009/03/17 09:40:37 | WrapperManager Debug: Server >>> daemon shut down >>> DEBUG | wrapper | 2009/03/17 09:40:37 | JVM process exited with a code >>> of >>> 0, leaving the wrapper exit code set to 0. >>> DEBUG | wrapper | 2009/03/17 09:40:37 | JVM exited normally. >>> STATUS | wrapper | 2009/03/17 09:40:37 | <-- Wrapper Stopped >>> >>> This log say us something. >>> >>> Thanks in advance!!. |