Running Java applications as a service - startup error captures?
I'm in the arduous process of trying to upgrade a couple of our servers to use a current version of the application installed on it and I've gotten a bit stuck. I've gotten everything replaced and have narrowed my issue down to 1 .jar file. If I use the new version of this specific file, I can not get the service to start, and using the old vers开发者_运维问答ion (and the new version of every other file), it runs fine.
When I try to start the service I get this message: Could not start <service> service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error.
I've looked in the event viewer, and all it has are these entries every time I try to start it:
<Service> has started
Could not find the service start class
<service> has failed to start
Is there some place else that I can look that might be able to give a bit more information on why it's failing to start?
We are using the 'JavaService' utility to create the windows process. This server is also running jboss.
EDIT: I have also determined that it is not an issue with my SQL database as I just did all of the upgrades between the versions. I still can't get it to start with the new .jar, and the old .jar still works.
Thanks!
You can't execute a java application as a service. Windows services implement a specific interface that java.exe or javaw.com do not. You will need a wrapper to implement this functionality. One such wrapper is http://wrapper.tanukisoftware.org.
As Pierre mentioned, you can't run java directly as a Windows service. Apache commons daemon (a.k.a. Procrun) is another tool that will adapt a java application for use as a Windows service.
I found the issue!
After days and days of looking around at configuration files, I finally noticed something: We are now using log4j for logging but it wasn't included in the .jar's manifest! I added it to the manifest and it now starts up!
Thanks for your help everyone :]
精彩评论