title: How can a service MBean depend on singleton stateless session bean using jboss-service.xml in wildfly 8
body: <p>I am trying to provide a <code>service mbean</code> a <code>singleton stateless session bean</code> by configuring in <code>jboss-service.xml</code>using <code>&lt;depends&gt;</code> in wildfly AS 8 but getting the below error:</p>
  
  <pre><code>ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" =&gt; "TestEAR.ear")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" =&gt; [
  "jboss.mbean.service.TestService.start is missing [jboss.mbean.service.\"jboss.j2ee:ear=TestEAR.ear,jar=module-A.jar,name=TestConfig,service=EJB3\".start]",
  "jboss.mbean.service.TestService.create is missing [jboss.mbean.service.\"jboss.j2ee:ear=TestEAR.ear,jar=module-A.jar,name=TestConfig,service=EJB3\".create]"
  </code></pre>
  
  <p>Please find below the details on the code employed: Please help me to resolve the error. Many thanks.</p>
  
  <p><strong>project structure</strong></p>
  
  <p>TestEAR (ear)</p>
  
  <p>--- module-A (ejb jar containing singleton stateless session bean)
  <br/>
  --- module-B (jar containing service mbean)</p>
  
  <p><strong>singleton stateless session bean (under module-A JAR)</strong></p>
  
  <pre><code>@Local(TestLocal.class)
  @Resource(name="TestConfig", mappedName="java:/ConnectionFactory")
  public class TestConfig {
  ... code ...
  }
  </code></pre>
  
  <p><strong>jboss-service.xml (under meta-inf folder in TestEAR.ear)</strong></p>
  
  <pre><code>&lt;server&gt;
  &lt;mbean code="com.test.TestService" name="TestService"&gt;
  &lt;depends&gt;jboss.j2ee:ear=TestEAR.ear,jar=module-A.jar,name=TestConfig,service=EJB3&lt;/depends&gt;
  &lt;/mbean&gt;
  </code></pre>
  
  <p><strong>TestService.java (MBean) (under module-B JAR)</strong></p>
  
  <pre><code>public class TestService extends ServiceMBeanSupport implements TestMBean { 
  protected void startService() throws Exception {
  ...code...
  }
  protected void stopService() throws Exception {
  ...code...
  }
  protected void createService() throws Exception {
  ...code...
  }
  protected void destroyService() throws Exception {
  ...code...
  }
  }
  </code></pre>
  
  <p><strong>TestMBean.java (MBean interface) (under module-B JAR)</strong></p>
  
  <pre><code>public interface TestMBean extends org.jboss.system.ServiceMBean { }
  </code></pre>