3

My EAR consists out of an common-jar, an EJB-jar and a WAR. The WAR uses a spring context, so it is dependend on the spring-namespace description files in the META-INF direcotry.

My WAR/jboss-deployment-structure.xml contains

<module name="org.springfw">
    <imports>
        <include path="META-INF**" />
        <include path="org**" />
    </imports>
</module>

If i deploy the EAR and the WAR seperatly, the application works perfectly.

By deploying the same WAR inside of the EAR it fails with a ClassNotFoundException (org.spring...ContextLoaderListener).

Well, i edited my WAR/META-INF/Manifest.MF and added "Dependencies: org.springfw", the application fails on startup with:

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]

This means the classes are available, but not the META-INF files.

To sum it up: If i deploy a WAR inside an EAR, i can still import modules via the Manifest of the WAR (works, but cant import the META-INF directory), but the WEB-INF/jboss-deployment-structure.xml will always be ignored.

EDIT:

The module descriptor is

 <resource-root path="spring-context-3.2.10.RELEASE.jar">
         <filter>
            <include path="META-INF**" />
            <include path="org**" />
        </filter>
 </resource-root>
Martin Baumgartner
  • 3,524
  • 3
  • 20
  • 31
  • 1
    deployment-structure must be in the top level META-INF folder, so in case of EAR it should be in the META-INF of the EAR. – cy3er Oct 01 '14 at 08:57
  • If i understand you correctly, Jboss permitts only one deployment-structure.xml in the EAR? – Martin Baumgartner Oct 01 '14 at 09:16
  • Maybe it will ignore it, [doc](https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7#ClassLoadinginAS7-JBossDeploymentStructureFile) – cy3er Oct 01 '14 at 09:19
  • My solution to a similar problem was to add the dependency to the module in the jboss-deployment-structure of the ear(top-level deployment) with export="true". Additional info: In my arquillian tests in order to be able to use the module I had to add this: war.setManifest(new StringAsset("Dependencies: some.thing\n")); when building the WebArchive (https://issues.jboss.org/browse/WFLY-942). – anna Mar 19 '15 at 23:09

2 Answers2

1

Specify <sub-deployment> in your deployment-structure.xml.

And as said already, this xml should be in to top level ear meta-Inf.

<jboss-deployment-structure>
 <sub-deployment name="myapp.war">
   <dependencies>
     <module name="org.javassist" export="true" />
     <module name="org.apache" export="true"/>
     <module name="org.antlr" export="true"/>
     <module name="org.dom4j" export="true"/>
     <module name="org.apache" export="true"/>
     <module name="org.hibernate" export="true"/>
   </dependencies>
 </sub-deployment>

See also jboss-deployment-structure.xml does not loads the dependencies in My EAR project

lazydev
  • 402
  • 4
  • 16
0

Have you tried using module descriptor? https://docs.jboss.org/author/display/MODULES/Module+descriptors

eyesfree
  • 126
  • 2
  • 5