|
From: Leif M. <lei...@ta...> - 2009-03-07 02:22:39
|
Zeynep,
I see. Most likeyl your environment variables were being defined as
User level Evnironment Variables. They need to be defined as system
environment variables for them to be visible from the SYSTEM account
that the services run under by default.
Glad you got it working. Let me know if you run into any other issues.
Cheers,
Leif
On Sat, Mar 7, 2009 at 2:41 AM, Gunal, Zeynep <zey...@tr...> wrote:
> Hi Leif,
>
> Thank you so much for your quick reply! And thanks for explaining how the Wrapper process works in 1).
>
> I managed to start the service eventually, and this I owe to your suggestion, which allowed me to see the real differences between the two java commands.
>
> I will elaborate this a bit in case newbies like me hit a similar problem.
>
>
> 1) I did as you said, removed the "-Dwrapper.key=NNNN" argument and this time is was a success, even though the service could not be started (and I know now why this was the case, see 2) below):
>
> C:\ADVLLoaderNew\ADVLLoader\bin>net start ADVLStatsLoaderGP
> The ADVLStatsLoaderGP service is starting............
> The ADVLStatsLoaderGP service could not be started.
>
> A service specific error occurred: 1.
>
> More help is available by typing NET HELPMSG 3547.
>
>
> C:\ADVLLoaderNew\ADVLLoader\bin>
> C:\ADVLLoaderNew\ADVLLoader\bin>set UnitCode
> UnitCode=GP
>
> C:\ADVLLoaderNew\ADVLLoader\bin>"C:\Program Files\Java\jdk1.5.0_17\bin\java" -DRunAsService=TRUE -DUnitCode=%UnitCode% -Dlog4j.configuration=file:%log4jPropFile% -Dshutdown.method=shutDown -Djava.library.path="../../lib" -classpath "../../lib/wrapper.jar;../../lib/wrappertest.jar;../lib/ADVLLoader.jar;../../lib/groovy-1.5.7.jar;../../lib/asm-2.2.jar;../../lib/log4j-1.2.12.jar;../../lib/sqljdbc.jar;../../lib/activation.jar;../../lib/mail.jar" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=1376 -Dwrapper.version="3.3.2" -Dwrapper.native_library="wrapper" -Dwrapper.service="TRUE" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=4 org.tanukisoftware.wrapper.WrapperSimpleApp com.truvo.advertiserLounge.dataProcessing.dataImport.loader.InputHandler
> WrapperManager Debug: WrapperManager class initialized by thread: main Using classloader: sun.misc.Launcher$AppClassLoader@133056f
> WrapperManager: Initializing...
> WrapperManager Debug: JVM #4
> WrapperManager Debug: Running a 32-bit JVM.
> WrapperManager Debug: Registering shutdown hook
> WrapperManager Debug: Not using wrapper. (key not specified)
> WrapperManager Debug: Load native library. One or more attempts may fail if platform specific libraries do not exist. This is NORM
> AL and is only a problem if they all fail.
> WrapperManager Debug: Loaded native library: wrapper-windows-x86-32.dll
> WrapperManager Debug: Calling native initialization method.
> WrapperJNI Debug: Initializing WrapperManager native library.
> WrapperJNI Debug: Java Executable: C:\Program Files\Java\jdk1.5.0_17\bin\java.exe
> WrapperJNI Debug: Windows version: 5.1.2600
> WrapperManager Debug: Java Version : 1.5.0_17-b04 Java HotSpot(TM) Client VM
> WrapperManager Debug: Java VM Vendor : Sun Microsystems Inc.
> WrapperManager Debug: OS Name : Windows XP
> WrapperManager Debug: OS Arch : x86
> WrapperManager Debug:
> WrapperManager Debug: Control event monitor thread started.
> WrapperManager Debug: Startup runner thread started.
> WrapperManager Debug: WrapperManager.start(org.tanukisoftware.wrapper.WrapperSimpleApp@1a0c10f, args[]) called by thread: main
> WrapperManager Debug: calling WrapperListener.start()
> WrapperManager Debug: Waiting for WrapperListener.start runner thread to complete.
> WrapperManager Debug: WrapperListener.start runner thread started.
> WrapperSimpleApp Debug: start(args) Will wait up to 2 seconds for the main method to complete.
> WrapperSimpleApp Debug: invoking main method
> WrapperSimpleApp Debug: main method completed
> WrapperSimpleApp Debug: start(args) end. Main Completed=true, exitCode=null
> WrapperManager Debug: returned from WrapperListener.start()
>
> 2) It is a conscious decision to have my application jar file in a different folder, so that was not the issue. The real issue was that I was trying *don't laugh :-)* to use environment variables in the wrapper configuration file, like:
>
> wrapper.java.additional.2=-DUnitCode=%UnitCode%
> wrapper.java.additional.3=-Dlog4j.configuration=file:%log4jPropFile%
>
> When the command file that defines them and the "net start" command are executed in the same cmd session, as I was doing, there was no problem. But the moment the service was started from the Windows services window, it was failing because these variables were unknown. Sadly, the exception java.lang.ExceptionInInitializerError is not sufficient to get to the heart of the problem...
>
> Anyway, once I replaced them by the actual values, everything worked as they should be.
>
>
> Thanks again.
> Zeynep
>
>
> -----Original Message-----
> From: Leif Mortenson [mailto:le...@ta...]
> Sent: 06 March 2009 17:38
> To: wra...@li...
> Subject: Re: [Wrapper-user] Cannot start my application as a Windows service
>
> Zeynep,
> 1) First let me explain the output in your commandprompt.txt file.
> You have copied the Java command line generated by the wrapper as is
> and are attempting to run it from a batch file or something? The
> problem is that if you do that as is, the WrapperManager class will
> attempt to open a control socket back to the Wrapper process. In this
> case, the Wrapper process does not exist so the WrapperManager fails
> and intentionally exits the JVM.
>
> To run without the Wrapper, copy the full command line as you did, but
> remove the "-Dwrapper.key=NNNN" argument. If that does not exist,
> then the WrapperManager will run in a standalone mode that lets you
> test without the Wrapper process.
>
> 2) The main problem is the class not found issue:
> INFO | jvm 1 | 2009/03/06 13:38:55 | WrapperSimpleApp: Unable to
> locate the class
> com.truvo.advertiserLounge.dataProcessing.dataImport.loader.InputHandler:
> java.lang.ExceptionInInitializerError
> This is of course being caused because your
> com.truvo.advertiserLounge.dataProcessing.dataImport.loader.InputHandler
> class is not being found on the classpath. Which jar file should it
> be located in? My guess is ADVLLoader.jar? I notice that that one
> classpath element is "../lib/" while the others are all "../../lib/".
> Could that be your problem?
>
> Cheers,
> Leif
>
> On Fri, Mar 6, 2009 at 10:43 PM, Gunal, Zeynep <zey...@tr...> wrote:
>>
>>
>> Hi,
>>
>>
>>
>> This subject has been kind of discussed before but I couldn't find a
>> solution in the archives.
>>
>>
>>
>> When I start the application as a service, this is the error in the log file
>> (cf. wrapper.log):
>>
>>
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperManager Debug: Startup
>> runner thread started.
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperSimpleApp: Unable to locate
>> the class
>> com.truvo.advertiserLounge.dataProcessing.dataImport.loader.InputHandler:
>> java.lang.ExceptionInInitializerError
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 |
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperSimpleApp Usage:
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | java
>> org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 |
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | Where:
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | app_class: The fully
>> qualified class name of the application to run.
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | app_arguments: The arguments
>> that would normally be passed to the
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | application.
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperManager Debug:
>> WrapperManager.stop(1) called by thread: main
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperManager Debug: Backend
>> socket not connected, not sending packet STOP : 1
>>
>> INFO | jvm 5 | 2009/03/06 13:39:21 | WrapperManager Debug: Control
>> event monitor thread started.
>>
>> INFO | jvm 5 | 2009/03/06 13:39:22 | WrapperManager Debug: Thread,
>> main, handling the shutdown process.
>>
>> INFO | jvm 5 | 2009/03/06 13:39:22 | WrapperManager Debug:
>> shutdownJVM(1) Thread:main
>>
>> INFO | jvm 5 | 2009/03/06 13:39:22 | WrapperManager Debug: Backend
>> socket not connected, not sending packet STOPPED : 1
>>
>> INFO | jvm 5 | 2009/03/06 13:39:22 | WrapperManager Debug: calling
>> System.exit(1)
>>
>> DEBUG | wrapper | 2009/03/06 13:39:22 | JVM process exited with a code of
>> 1, setting the wrapper exit code to 1.
>>
>> ERROR | wrapper | 2009/03/06 13:39:22 | JVM exited while loading the
>> application.
>>
>>
>>
>> When I copy/paste the java run command which is in the log file to the
>> command line, the following happens (cf. commandprompt.txt):
>>
>>
>>
>> WrapperManager Debug: Control event monitor thread started.
>>
>> WrapperManager Debug: Startup runner thread started.
>>
>> WrapperManager Debug:
>> WrapperManager.start(org.tanukisoftware.wrapper.WrapperSimpleApp@e2eec8,
>> args[]) called by thread: main
>>
>> WrapperManager Debug: Communications runner thread started.
>>
>> WrapperManager Debug: Open socket to wrapper...Wrapper-Connection
>>
>> WrapperManager Error: Failed to connect to the Wrapper at port 32000.
>> Cause: java.net.ConnectException: Connection refused: connect
>>
>>
>>
>> WrapperManager Error: Exiting JVM...
>>
>>
>>
>> My application runs correctly as standalone, and also with the console
>> option of Wrapper (cf. commandprompt-console.txt)
>>
>>
>>
>> What is it that I am missing? I am sending you the command file
>> (installADVLStatisticsService.txt.wasbat) and the config file
>> (wrapper_config.properties) in case you would want to see them. I
>> desperately need another pair of eyes to pinpoint the problem!
>>
>>
>>
>> Thanks for your support,
>>
>>
>>
>> Zeynep
|