We are using JBoss 3.0.4. I have startup code that can't execute until after my EJB has been deployed. Here's my plan of attack:
1) Listen for an "EJB Module created" notification from EJBModule for my bean and run the startup code aftewards
2) Listen for an "Undeploying" notification from MainDeployer for my bean and run any shutdown code before my EJB is undeployed
So far, I can capture the events from MainDeployer by calling the following code in my MBean:
mBeanServer.addNotificationListener(MainDeployerMBean.OBJECT_NAME, this, null, "local");
What I can't figure out is how to add a listener to EJBModule.
Any ideas how find the ObjectName for EJBModule?
Is there a better way to do this?
Main issue solved...I added a to my MBean xml file on my EJB. Now my bean only starts after the EJB is loaded.
I'd still like a way to capture deploy/undeploy messages. I'd like to be able to hot deploy an EAR file to the app server and have my mbean run shutdown code right before the EAR is undeployed and run startup code right after the new EAR is deployed.
Any ideas appreciated.