Tomcat在关闭jar时关闭 [英] Tomcat shuts down on closing jar

查看:107
本文介绍了Tomcat在关闭jar时关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个Java Web应用程序,该Web应用程序从包含在WebAppLibraries中的jar文件中调用了main方法,当该main调用system.exit终止时,它也关闭了Web应用程序,从而关闭了tomcat.如何避免关闭仅关闭该主要方法执行的Web应用程序?

I made a java web application that calls a main method from a jar file i included as a WebAppLibraries and when this main calls system.exit to terminate it shuts down also the web app closing tomcat. How can avoid to shut down the web app closing only the execution of that main method?

推荐答案

通过不调用System.exit().,而是调用适当的API来关闭容器的Web应用程序,这是特定于容器的. System.exit()是不是.请参阅Javadoc.用于关闭整个JVM,例如servlet容器.

By not calling System.exit(). Instead, call the appropriate API for shutting down web-apps for your container, which is container-specific. System.exit() isn't it. See the Javadoc. It's for shutting down entire JVMs, such as servlet containers.

这篇关于Tomcat在关闭jar时关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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