ejbmbeanssar

EJB Lookup inside SAR


My EAR contains an ejb file and a sar file. I cannot do a lookup on a deployed ejb bean inside of a MBEAN contained in the SAR file.

I am getting NameNotFoundException. How can I do a lookup in the ejb2x home interface inside the mbean service (deployed via the sar file on the EAR)????


Solution

  • I have solved this issue as below:

    1) The MBean could not locate que EJB in jndi tree because it was not referenced in the mbean declaration as a dependency. So, I did this:

    <mbean code="app.SchedulerManager" name="Company:service=SchedulerManager">
       <depends>jboss.j2ee:module=my-ejb-jar.jar,service=EjbModule</depends>
    </mbean>
    

    2) I also declared the in the META-INF/jboss.xml of the ejb jar so that the dependency can be found:

    <jmx-name>jboss.j2ee:module=my-ejb-jar.jar,service=EjbModule</jmx-name>