How do I make sure my MBean is deployed after my EJB ?

If your MBean is dependent on another resource, supposing contained in an EAR file, you can specify in your jboss-service.xml not to deploy before this resource is available. Use the tag “depends” for this purpose

For example:

<server>
  
  <mbean code="sample.HelloWorldService" name="sample:service=HelloWorld,id=1">
    <depends>jboss.j2ee:service=EARDeployment,url='application.ear'</depends>
  </mbean>

</server>

The same dependancy can be applied also for other package like Jar….

<server>
  
  <mbean code="sample.HelloWorldService" name="sample:service=HelloWorld,id=1">
    <depends>jboss.j2ee:service=JARDeployment,url='ejbsample.jar'</depends>
  </mbean>

</server>