I'm creating a sample J2EE application with JBoss, with some EJBs and some MBeans.
What I would like is simple : the "create" callback of my MBean sould call a method from a session bean.
I saw that in the FAQ : http://wiki.jboss.org/wiki/Wiki.jsp?page=HowCanAnMBeanDependOnASessionBean
I made what was written : putting the dependency in the jboss.service.xml ; but it doesn't work... The problem may be that the MBean and the EJBs are in the same jar file. So I tried to organize differently my .ear file :
mySample.ear - META-INF - application.xml - jboss-app.xml - mySampleMBeans.jar - ... - Toto.class <- the MBean implementation - TotoMBean.class <- the MBean interface - ... - myEJBs.jar - META-INF - persistence.xml - ... - myFacade.class <- the Session Bean implementation - myFacadeRemote.class <- the Session Bean interface - ... - mySampleMBeans.sar - META-INF - jboss-service.xml
<?xml version="1.0"?> <server> <mbean code="com.xxx.yyy.jmx.Toto" name="XXXX:service=Toto"> <depends> jboss:service=Naming </depends> <depends> jboss.j2ee:module=myEJBs.jar,service=EjbModule </depends> </mbean> </server>