1 Reply Latest reply on Apr 4, 2012 4:15 PM by askaralus

    MBean depending on EJB

    akoledzhikov

      Can you help me with the following use-case - an ear has a sar and ejb-jar in it. One of the mbeans needs to call a stateless ejb from the jar. The problem is that sometimes the ejb isn't loaded by the time the mbean tries to access it. What I've tried to specify a deployment order so far:

      1) Added a dependency to the ejb-jar in the sar's manifest - nothing changed.

      2) Added the same dependency in the jboss-deployment-structure.xml - same result.

      3) Added dependency to the ejb jar in the mbean description in jboss-service.xml. I expected this to work (since in another use case, I've resolved a mbean-to-mbean dependency in the same manner) but it didn't - the JBoss complained about {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.mbean.service.\ ... yada-yada-yada... myproject-ejb.jar\".start]"]}. The object name I've used in the <depends> element was jboss.as:deployment=myproject-ear.ear,subdeployment=myproject-ejb.jar.

      4) Added a dependency to the ejb itself in the jboss-service.xml, using the following object name - jboss.as:deployment= myproject -ear.ear,subdeployment= myproject -ejb.jar,subsystem=ejb3,stateless-session-bean=MyBeanEJB - the log output was almost the same, but with ending with "... MyBeanEJB".create".

       

      So, how can I make sure that the ejb is up and running before the mbean tries to start? Or, even better, is there a way to directly inject the ejb and not bother with lookups and such?