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

只愿长相守 提交于 2019-12-13 14:00:35

问题


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>

回答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




回答2:


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



来源:https://stackoverflow.com/questions/26137219/war-in-ear-jboss-deployment-structure-xml-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!