title: JBoss: WAR file in EAR can't find JAR library on classpath
body: <p>I am having a problem deploying an ear with bundled wars, jars, and configuration files (.properties files) on JBoss 4.3-eap.  Here is my ear structure:  </p>
  
  <pre><code>+app.ear   
    +lib  
      *.jar libraries that the war's use  
      +classes  
        *.properties and other configuration files 
    +META-INF  
      application.xml  
      jbos-app.xml  
    app.war  
    app2.war  
    appn.war  
  </code></pre>
  
  <p>I have the following in my jboss-app.xml :  </p>
  
  <pre><code>&lt;jboss-app&gt;
    &lt;jmx-name&gt;app.startup.JbossStartUpServer:service=JbossStartUpService&lt;/jmx-name&gt;
  &lt;/jboss-app&gt;    
  </code></pre>
  
  <p>My application.xml looks like this:  </p>
  
  <pre><code>&lt;application id="app_id"&gt;
    &lt;display-name&gt;App&gt;/display-name&gt;
    &lt;description&gt;TheApp&gt;/description&gt;
  &lt;!--  
    &lt;module  id="core"&gt;
      &lt;java&gt;lib/core.jar&lt;/java&gt;
    &lt;/module&gt;
  
    &lt;module id="tag"&gt;
      &lt;java&gt;lib/tag.jar&lt;/java&gt;
    &lt;/module&gt;
  --&gt;  
    &lt;module id="app"&gt;
      &lt;web&gt;
        &lt;web-uri&gt;app.war&lt;/web-uri&gt;
        &lt;context-root&gt;/&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt; 
  
    &lt;module id="app2"&gt;
      &lt;web&gt;
        &lt;web-uri&gt;app2.war&lt;/web-uri&gt;
        &lt;context-root&gt;/app2&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt; 
  
    &lt;module id="appn"&gt;
      &lt;web&gt;
        &lt;web-uri&gt;appn.war&lt;/web-uri&gt;
        &lt;context-root&gt;/appn&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt;
  
    &lt;security-role id="secRole"&gt;
      &lt;description&gt;users&lt;/description&gt;
      &lt;role-name id="appRoleName"&gt;users&lt;/role-name&gt;
    &lt;/security-role&gt;
  
    &lt;library-directory&gt;lib&lt;/library-directory&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p>Basically, upon deploying the ear, I run into an issue where one of my wars can't find a class in the <code>core.jar</code> file (<code>java.lang.NoClassDefFoundErro</code>r).  I think this is due to the fact that the war is not finding this library, even though it is in the <code>lib</code> folder/classpath.  If I try to uncomment the first two modules to add the first party libraries (<code>core.jar</code> and <code>tag.jar</code>), all of a sudden the properties files can no longer be found (they are located, for now, in <code>lib/classes</code>, so that, I hope anyway, they are picked up by the classloader.  Ideally I'd like to put classes in its own directory and add it to the classpath separately, but for now I am just trying to make this work).  </p>
  
  <p>I have tried some other things, including manually adding <code>core.jar</code> to the war's <code>manifest.mf</code> file, changing <code>UseJBossWebLoader</code> to true in the <code>jboss-service.xml</code> file under the <code>jboss-web.deployer</code>, and various combinations of the above, to no success.  I either lose the <code>classes</code> directory from the classpath (<code>lib</code> folder) and none of my properties files get picked up, or the war can't access the proper class from the jar.  I think there must be some configuration that is wrong, and while I've tried reading up on the way JBoss does EAR deployments and classloading, I can't seem to adapt it to my current setup.  </p>
  
  <p>Any suggestions would be greatly appreciated.  </p>
  
  <p>Here are some sites that I have been looking at:<br>
  <a href="http://raibledesigns.com/rd/entry/jboss_classloader_logic" rel="nofollow noreferrer">Raible Designs JBoss ClassLoader Logic</a>  </p>
  
  <p>These are just a few of the sites I have looked at.  The problems might stem from the setup of the project as well, as this is a large established project that is (to an extent) being migrated from a weblogic deployment to Jboss.  So if there is anything that SHOULD work, but doesn't, it might be an issue with some of the code/project configuration.  Unfortunately, I am not at the point yet where I can tell if its a JBoss related problem, or a problem with the project.</p>