How to use Java Service Wrapper for our java application

时光总嘲笑我的痴心妄想 提交于 2019-12-11 07:35:21

问题


I'm trying to implement scheduler to my application. I use spring and quartz support. I have test my component and run perfectly.

My Main method is:

public class Main {
    public static void main(String[] args) {
        new ClassPathXmlApplicationContext("application-context.xml");
    }
}   

I use wrapper-windows-x86-32-3.5.7, I configure the wrapper.conf, and run from console using DemoApp.bat wrapper. It works.

But When I want to install the service, I got error message Startup failed: Timed out waiting for a signal from the JVM. After 5 times repetition, I got error message

JVM did not exit on request, terminated

There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.

Thanks for help.


回答1:


Because it is working fine for you running in a console, but not as a service. This is most likely a problem with the environment of the SYSTEM user. The most common cause is not being able to locate the java binary. The cause should be fairly obvious if you look in the wrapper.log file.

The default location of the java binary is: wrapper.java.command=java This will cause it to be found on the PATH. To use a JAVA_HOME location, try the following: wrapper.java.command=%JAVA_HOME%/bin/java Then make sure you have declared the JAVA_HOME variable as a SYSTEM WIDE variable, not jsut for your current user account.

Cheers, Leif



来源:https://stackoverflow.com/questions/5539212/how-to-use-java-service-wrapper-for-our-java-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!