开发者

Calling business logic methods at JBoss Server Startup

开发者 https://www.devze.com 2022-12-27 02:02 出处:网络
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.

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.


You could use a startup class for this (and put the startup class in the deploy.last subdirectory of deploy to get it run after other deployments are deployed).


MBeans can be used to do some process at JBoss startup or can alternatively use servlet which can be loaded easily at startup according to your requirement.

0

精彩评论

暂无评论...
验证码 换一张
取 消