Thanks for your quick reply. It at least points the direction. But it's still hard for me to figure out what actually to write and where to put it. (Documentation has never been a strength of JBoss. Hope the books I've ordered will mend this...)
Now I managed to get a start notification of the EARDeployer. But no chance to get a notification before undeploy. My jboss-service.xml is like:
<server> <mbean code="com.jcoffee.test.jboss.NotificationListener" name="jcoffee.ear:name=NotificationListener"> <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.j2ee:service=EARDeployer"/> </subscription-list> </attribute> </mbean> </server>
My listener class extends ListenerServiceMBeanSupport, subscribes in startService() with subscribe(true) and implements handleNotification2(). All this put in an SAR , added to my EAR and declared in jboss-app.xml deploys nicely, but all I can get is a notification after (re)deploy but none before undeploy. Anyone any comments on this?