简体   繁体   English

如何在Jboss中自动执行已部署的war文件?

[英]How to automatically execute deployed war file in Jboss?

I am running jsf application on Jboss. 我在Jboss上运行jsf应用程序。 Every time I start JBoss, the war file is successfully deployed, but I have to manually open the browser and enter the URL to start the application. 每次启动JBoss时,都会成功部署war文件,但是我必须手动打开浏览器并输入URL才能启动应用程序。 The problem is that this app should start automatically when the server is restarted. 问题在于,重新启动服务器后,该应用程序应自动启动。 I have a shell script that starts JBoss, but the app is started only when I open the browser and enter the url. 我有一个启动JBoss的shell脚本,但是仅当我打开浏览器并输入URL时,该应用程序才能启动。

How can I achieve this? 我该如何实现?

If you have any servlet in your war file then load that servlet on application startup. 如果您的war文件中有任何servlet,则在应用程序启动时加载该servlet。 And start the execution in init method of that servlet. 并以该servlet的init方法开始执行。

我通过将@Singleton和@Startup批注添加到启动的托管bean类中解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM