title: JBoss AS7. How to load some.jar before war in deployment?
body: <p>I have EAR which consist from war and jar. 
  <br/>
  project.ear
     <br/>
  ....package.war
  <br/>
  ....lib
  <br/>
  .......library.jar
  <br/>
  library.jar should be initialized before deploying war file. <br/>
  My application.xml file: <br/></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6"&gt;
    &lt;display-name&gt;project&lt;/display-name&gt;
    &lt;initialize-in-order&gt;true&lt;/initialize-in-order&gt;
    &lt;module&gt;
      &lt;java&gt;library.jar&lt;/java&gt;
    &lt;/module&gt;
    &lt;module&gt;
      &lt;web&gt;
        &lt;web-uri&gt;package.war&lt;/web-uri&gt;
        &lt;context-root&gt;/&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt;
    &lt;library-directory&gt;lib&lt;/library-directory&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>My jboss-deployment-structure.xml file:</p>
  
  
  
  <pre><code>&lt;jboss-deployment-structure&gt;
    &lt;ear-subdeployments-isolated&gt;false&lt;/ear-subdeployments-isolated&gt;
    &lt;deployment&gt;
       &lt;dependencies&gt;
            //some modules
        &lt;/dependencies&gt;
    &lt;/deployment&gt;
    &lt;sub-deployment name="library.jar"&gt;
        &lt;resources&gt;
          &lt;resource-root path="lib/library.jar"/&gt;
        &lt;/resources&gt;
    &lt;/sub-deployment&gt;
    &lt;sub-deployment name="package.war"&gt;
      &lt;exclusions&gt;
            &lt;module name="javax.faces.api" slot="main"/&gt;
            &lt;module name="com.sun.jsf-impl" slot="main"/&gt;
      &lt;/exclusions&gt;
     &lt;/sub-deployment&gt; 
  &lt;/jboss-deployment-structure&gt;
  </code></pre>
  
  <p>But when JBoss deploying my app, I see next error in log file.</p>
  
  <pre><code>{"JBAS014671: Failed services" =&gt; {"jboss.deployment.unit.\"project.ear\".STRUCTURE" =&gt; "org.jboss.msc.service.StartException in servi
  ce jboss.deployment.unit.\"project.ear\".STRUCTURE: JB
  AS018733: Failed to process phase STRUCTURE of deployment \"project.ear\"
      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
   JBAS011037: Unable to process modules in application.xml for EAR [\"/C:/DEV/jbo
  ss-eap-6.1/bin/content/project.ear\"], module file library.jar not found"}}
  </code></pre>
  
  <p>I need in strict loading of modules. Only when library.jar will be fully initialized, package.war should be deploying.</p>