WAR in EAR - jboss-deployment-structure.xml ignore

2019-07-07 00:05发布

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>

2条回答
smile是对你的礼貌
2楼-- · 2019-07-07 00:49
来,给爷笑一个
3楼-- · 2019-07-07 00:52

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

查看更多
登录 后发表回答