我的EAR由一个通用jar,一个EJB jar和一个WAR组成。 WAR使用spring上下文,所以它依赖于META-INF direcotry中的spring-namespace描述文件。EAR中的WAR - 忽略jboss-deployment-structure.xml
我WAR/JBoss的部署,structure.xml包含
<module name="org.springfw">
<imports>
<include path="META-INF**" />
<include path="org**" />
</imports>
</module>
如果我部署EAR和seperatly战争中,应用程序完美的作品。
通过在EAR内部部署相同的WAR,它会因ClassNotFoundException(org.spring ... ContextLoaderListener)而失败。
好吧,我编辑WAR/META-INF/MANIFEST.MF,并添加 “依赖关系:org.springfw”,在应用程序启动时失败:
无法找到春天NamespaceHandler XML模式命名空间[http://www.springframework.org/schema/context]
这意味着类是可用的,但不是META-INF文件。总结:如果我在EAR中部署一个WAR,我仍然可以通过WAR的清单(工程,但不能导入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>
部署结构必须在顶层META-INF文件夹,所以在EAR的情况下,它应该是在EAR的META-INF。 – cy3er 2014-10-01 08:57:42
如果我理解正确,Jboss只允许EAR中的一个deployment-structure.xml? – 2014-10-01 09:16:01
也许它会忽略它,[doc](https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7#ClassLoadinginAS7-JBossDeploymentStructureFile) – cy3er 2014-10-01 09:19:52