【发布时间】:2015-05-26 15:44:34
【问题描述】:
我正在使用 apache prunsrv 服务来安装 jar 作为 Windows 服务。
当服务关闭时,应用程序崩溃。
set PR_STARTMETHOD=main
set PR_STOPMETHOD=exit
我的启动和关闭类如下所示:
public class TravelportMainApp {
private static ConfigurableApplicationContext ctx;
public static void main(String[] args) {
ctx = SpringApplication.run(source, args);
ctx.registerShutdownHook();
}
public static void exit(String[] args) throws InterruptedException {
if (ctx != null && ctx instanceof AbstractApplicationContext) {
((AbstractApplicationContext) ctx).destroy();
}
Sysout("EXIT OK.");
}
}
结果:打印了退出命令“EXIT OK”,但随后命令行应用程序崩溃并显示“commons daemon service runner is not working up.”。这里有什么问题?
【问题讨论】:
标签: java spring spring-boot prunsrv