Have you considered writing a MBean service, when it is started you will be able to execute code then.
I am trying to write a set of session beans that will be able to register them selves with an MBean registry system I have created. So I would like to have each session bean self contained and register it self on deployment and unregister it self on undeployment.
Once again: do this using MBeans.
I need this to happen at deployment time of the Session bean not at the start up time. The session beans will be hot deployable. I guess I could create a MBean for each session bean and deployment them together. This is not as clean a solution as I wanted.
I guess you can create a single MBean and listen to the Notification sent by MainDeployer when a bean is deployed.
Look at the deploy method in MainDeployer.jar for the notification thats emitted. I have read about using the notifications in Juha's book, so that might be worth a try.