首页 文章

EAR中的WAR - jboss-deployment-structure.xml被忽略

提问于
浏览
3

我的EAR由一个common-jar,一个EJB-jar和一个WAR组成 . WAR使用spring上下文,因此它取决于META-INF目录中的spring-namespace描述文件 .

我的WAR / jboss-deployment-structure.xml包含

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

如果我单独部署EAR和WAR,应用程序将完美运行 .

通过在EAR内部部署相同的WAR,它会因ClassNotFoundException(org.spring ... ContextLoaderListener)而失败 .

好吧,我编辑了我的WAR / META-INF / Manifest.MF并添加了“Dependencies:org.springfw”,应用程序在启动时失败:

无法找到XML架构命名空间的Spring NamespaceHandler [http://www.springframework.org/schema/context]

这意味着类可用,但不是META-INF文件 .

总结一下:如果我在EAR中部署WAR,我仍然可以通过WAR的Manifest导入模块(工作,但不能导入META-INF目录),但是WEB-INF / jboss-deployment-structure . xml将始终被忽略 .

编辑:

模块描述符是

<resource-root path="spring-context-3.2.10.RELEASE.jar">
         <filter>
            <include path="META-INF**" />
            <include path="org**" />
        </filter>
 </resource-root>

2 回答

  • 0

    deployment-structure.xml 中指定 <sub-deployment> .

    如上所述,这个xml应该是顶级耳朵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>
    

    另见jboss-deployment-structure.xml does not loads the dependencies in My EAR project

  • 1

相关问题