简体   繁体   中英

Calling business logic methods at JBoss Server Startup

I have an EJB project communicating with a Swing client over RPC. I would like to know how to call EJB or utility class methods on the business logic at server startup.

Thanks.

Easiest way is to add a WAR with an application context listener. This listener has callbacks when the applications is started and stopped. It's a good area to place calls in to your back end logic when the application starts up or shuts down (server is stopped or app is undeployed).

EJB 3.1 is supposed to have better support for this, I don't know JBoss status on implementing 3.1. But I probably wouldn't upgrade just for this.

I should note that the WAR only works when bundled with the EJBs in an EAR, otherwise the WAR may start up before the EJBs are deployed.

您可以为此使用启动类 (并将启动类放在deploydeploy.last子目录中,以使其在部署其他部署之后运行)。

MBean可以在JBoss启动时用于执行某些过程,也可以使用servlet,根据您的要求,可以在启动时轻松加载servlet。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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