title: ClassNotFoundException in Wildfly 10 despite dependency being set
body: <p>I'm running an application on WildFly 10. It contains a number of EJBs in an EAR. I have one EJB "gt" being triggered via JMS. That EJB calls another EJB "ps", resulting in an error, ultimately</p>
  
  <p><code>Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.filefilter.IOFileFilter from [Module "deployment.MyApplication.ear:main" from Service Module Loader]
  </code></p>
  
  <p>My jboss-deployment-structure.xml contains this</p>
  
  <pre><code>&lt;sub-deployment name="ps.jar"&gt;
    &lt;dependencies&gt;
      &lt;module name="org.apache.commons.io"/&gt;
    &lt;/dependencies&gt;
  &lt;/sub-deployment&gt;
  </code></pre>
  
  <p>And there is a module of name "org.apache.commons.io" under <code>jboss\modules\system\layers\base\org\apache\commons\io\main</code></p>
  
  <p>What am I doing wrong?
  What is the significance of stuff being under <code>jboss\modules\system\layers</code> rather than just under <code>jboss\modules</code>?</p>
  
  <p>Is there a way to look into the configured dependencies of a sub-deployment at runtime, e.g, via the jboss-cli?</p>
  
  <p>Update:<br>
  According to <a href="https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly" rel="nofollow">https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly</a>, I would have expected the error message to say <code>[Module "deplyoment.MyApplication.ear<b>.ps.jar</b>:main" ...]</code>, but it doesn't. But why would the context be the global deployment, rather than the specific sub-deployment?</p>
  
  <p>The logical call stack looks like this:</p>
  
  <pre><code>general.GeneralSomeClass.getIOFileFilter()
      &lt;-- static method. return type is IOFileFilter from Commons IO. 
          general is just a POJO lib (MyApplication.ear/lib/general.jar)
          the exception occurs on loading the GeneralSomeClass, before calling the method
  ps.PsSomeClass.run()
  ps.PsEJB.run()
  gt.GtEJB.run()
  </code></pre>