I have EAR which consist from war and jar.
project.ear
....package.war
....lib
.......library.jar
library.jar should be initialized before deploying war file.
My application.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<display-name>project</display-name>
<initialize-in-order>true</initialize-in-order>
<module>
<java>library.jar</java>
</module>
<module>
<web>
<web-uri>package.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
My jboss-deployment-structure.xml file:
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
//some modules
</dependencies>
</deployment>
<sub-deployment name="library.jar">
<resources>
<resource-root path="lib/library.jar"/>
</resources>
</sub-deployment>
<sub-deployment name="package.war">
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
But when JBoss deploying my app, I see next error in log file.
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"project.ear\".STRUCTURE" => "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"}}
I need in strict loading of modules. Only when library.jar will be fully initialized, package.war should be deploying.
As I already told before, I have to initiliaze spring JMX settings before another configuration. Spring parent context is a great way for solving this issue. Just define parentContextKey as you need and Spring will do everything itself.