tags:

views:

624

answers:

5

Hi All:
I have a jar application which process n converts file into csv file. I have made it to run in windows service using Java Service Wrapper. It got installed my jar application successfully when i run "InstallApp-NT.bat" file and starts running my application when i run "app" command. But when i try to start the service in services, its not starting and showing following message in dialog box
"Windows could not start the generic Preprocessor application on Local Computer. For more information, review the System Event Log. If this is a non-microsoft service, contact the service vendor, and refer to service-specific error code1".
I have the system log file and it showing the below error message
System Event log :
--> Wrapper Started as Service
Java Service Wrapper Community Edition 3.3.2
Copyright (C) 1999-2009 Tanuki Software, Ltd. All Rights Reserved.
http://wrapper.tanukisoftware.org
Launching a JVM...
WrapperManager: Initializing...
WrapperSimpleApp:
WrapperSimpleApp: Encountered an error running main:
WrapperSimpleApp: java.lang.NullPointerException
WrapperSimpleApp: at java.util.Hashtable.put(Hashtable.java:396)
WrapperSimpleApp: at java.util.Properties.setProperty(Properties.java:128)
WrapperSimpleApp: at java.lang.System.setProperty(System.java:701)
WrapperSimpleApp: at com.dnb.genericpreprocessor.process.ProcessRunner.main(Unknown Source)
WrapperSimpleApp: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
WrapperSimpleApp: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
WrapperSimpleApp: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

WrapperSimpleApp: at java.lang.reflect.Method.invoke(Method.java:585)
WrapperSimpleApp: at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:238)
WrapperSimpleApp: at java.lang.Thread.run(Thread.java:595)
<-- Wrapper Stopped

I don think any error in application code because it running fine when run "app" command. Please help what i should now. thanks in advance.

A: 

Check com.dnb.genericpreprocessor.process.ProcessRunner if that is your code and see what data you are setting in System property. NullPointer is telling that the key or the value you passed is Null.

Bhushan
It is because of "System.getenv()" method i used in the code. Its not getting user variable's value during runtime when we start the window service.
raja
A: 

Check your wrapper.config; you need to have all the necessary jars in order, and each with their own index number (for some reason):

wrapper.java.classpath.1=../lib/wrapper.jar

wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar

...

Just a first thought.

Robert Grant
Hi Robert :<br>I have check wrapper.config file.. All the jar has been given in right index number only.
raja
It is because of "System.getenv()" method i used in the code. Its not getting user variable's value during runtime when we start the window service
raja
A: 

I am not familiar with the proprietary solution you are using, but it seems you somehow configured it wrong.

Looks like some parameter the wrapper should have is null and is propagating all the way up until the system is trying to set it as property.

Yuval A
A: 

Hi :
I am using the following code in com.dnb.genericpreprocessor.process.ProcessRunner class.
Code :
String projectHome = "D:\BL";
System.setProperty("project.home", projectHome);
System.setProperty("log.home",System.getenv("DBE")); ---> DBE is the envirinment variable i created in user variables.
When i run the application by giving app command.. Its running the application by printing the environment value but showing the same error when i start it in service.

raja
What account your service is using to run? Also have you restarted your system after defining that variable? Last try defining that variable as System level variable.
Bhushan
+1  A: 

Answering your question update that you phrased as an answer, you need to ensure that the variable is in fact set in the specific environment where you are running the application. It appears that it is not. In fact, to avoid the NullPointerException, I would modify your code to something like:

String loghome = System.getenv("DBE");
if (loghome == null) {
  // LOG A COMPLAINT that the environment variable is not set
  loghome = "some reasonable default value";
}
System.setProperty("log.home", loghome);

so at least your application won't fail with an obtuse NPE if it is executed in the wrong environment.

Eddie