如何为我们的 Java 应用程序使用 Java Service Wrapper [英] How to use Java Service Wrapper for our java application

查看:31
本文介绍了如何为我们的 Java 应用程序使用 Java Service Wrapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的应用程序实施调度程序.我使用弹簧和石英支架.我已经测试了我的组件并完美运行.

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

我的主要方法是:

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

我使用 wrapper-windows-x86-32-3.5.7,我配置了 wrapper.conf,并使用 DemoApp.bat 包装器从控制台运行.它有效.

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

但是当我想安装该服务时,我收到错误消息 启动失败:等待来自 JVM 的信号超时.重复 5 次后,我收到错误消息

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 未根据请求退出,已终止

连续启动 5 次失败,每次持续时间不到 300 秒.放弃.

感谢您的帮助.

推荐答案

因为它可以很好地运行在控制台中,但不能作为服务运行.这很可能是 SYSTEM 用户的环境问题.最常见的原因是无法找到 java 二进制文件.如果您查看 wrapper.log 文件,原因应该很明显.

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.

java 二进制文件的默认位置是:包装器.java.command=java这将导致它在 PATH 上被找到.要使用 JAVA_HOME 位置,请尝试以下操作:wrapper.java.command=%JAVA_HOME%/bin/java然后确保您已将 JAVA_HOME 变量声明为 SYSTEM WIDE 变量,而不是针对您当前的用户帐户.

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.

干杯,莱夫

这篇关于如何为我们的 Java 应用程序使用 Java Service Wrapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆