Hi, everybody!
I want to make call some business code after my ear deploed or when jboss started.
I implement sample http://community.jboss.org/wiki/ExampleMinimalNotificationListener override methode handleNotification2()
My deploylistener-service.xml looks like :
<server>
<mbean code="my.business.project.NotificationListener" name="rmy.business.project:name=NotificationListener">
<attribute name="SubscriptionList">
<subscription-list>
<mbean name="jboss.system:type=Server">
<notification type="org.jboss.system.server.started"></notification>
</mbean>
<mbean name="jboss.j2ee:service=EARDeployer">
<notification type="org.jboss.deployment.SubDeployer.start"></notification>
</mbean>
<mbean name="jboss.ejb:service=EJBDeployer">
<notification type="org.jboss.deployment.SubDeployer.start"></notification>
</mbean>
</subscription-list>
</attribute>
</mbean>
</server>
But I has troubles:
1. it seems like notifications from EJBDeployer and EARDeployer don't broadsted, only org.jboss.system.server.started;
2. To locate my business beans inside methode handleNotification2() i use InitialContext. But when i try, throws exception javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
3. I try make my listener class stateless bean (annotate it @Statless), insert field bussines bean and use
@EJB
private IMyBusinessSessionRemote myBusinessSessionRemote;
But inside handleNotification2()
myBusinessSessionRemote is not initialized (null);
Please advice:
1. How can I access to my business code (to my EJB components) from inside listener
2. Could anyone give sample about correct jar and ear deployment listener
Thanks for any advice.
P.S. Sorry for my poor English.
ExampleMinimalNotificationListener