JBoss7中的Spring模块
我正在尝试将Spring3.0.6库设置为JBoss7中的一个模块 我在modules/org/springframework/main中有所有JAR,还有下面的module.xmlJBoss7中的Spring模块,spring,jboss,jboss7.x,Spring,Jboss,Jboss7.x,我正在尝试将Spring3.0.6库设置为JBoss7中的一个模块 我在modules/org/springframework/main中有所有JAR,还有下面的module.xml <module xmlns:"urn:jboss:module:1.0" name="org.springframework"> <resources> <resource-root path="org.springframework.beans-3.0.6
<module xmlns:"urn:jboss:module:1.0" name="org.springframework">
<resources>
<resource-root path="org.springframework.beans-3.0.6.RELEASE.jar"/>
...
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
我的第一个想法是模块没有被使用,但是如果我从依赖项行中删除org.springframework
,它将无法找到org.springframework.web.context.ContextLoaderListener
如果我将JAR放在WEB-INF/lib中而不是使用模块,那么一切都可以正常工作
springservlet.xml
包含以下模式引用
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
因此,我将spring-beans-3.0.xsd
放在与spring servlet.xml
相同的目录中,并将xml修改为
http://www.springframework.org/schema/beans spring-beans-3.0.xsd
但还是没有运气
任何人都知道为什么会找到类文件而没有找到xsd文件吗?为了防止注释中给出的链接消失,问题是 问题: 命名空间配置文件位于META-INF中,但该目录 不可见(也不可通过 jboss部署结构(xml) 解决方案:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
<module name="org.apache.commons.logging"/>
<module name="org.springframework" >
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
</module>
</dependencies>
</jboss-deployment-structure>
面临着完全相同的问题。在JBoss 7上设置了spring模块,然后在部署我的应用程序时,遇到以下警告:
无法读取架构文档
''
在阅读了上面注释中的链接后,我知道spring上下文文件无法从spring JAR访问模式定义。因此,应用程序没有得到部署。但是那里给出的解决方案对我来说不起作用。但是jboss-deployment-structure.xml中的以下代码解决了这个问题
解决方案
<module name="org.springframework.spring" meta-inf="export" export="true" />
添加了meta inf=“export”
属性。您的jar是这样命名的:org.springframework.beans-3.0.6.RELEASE.jar还是仅仅是beans-3.0.6.RELEASE.jar?这个jar命名为org.springframework.beans-3.0.6.RELEASE.jar,其他JAR的名称与spring发行版的名称类似。扫描模块时,JAR似乎可以识别,因为模块中的每个JAR都有一个.index文件。顺便说一句,我正在JBoss 7.0.2上尝试此操作。请看一下线程。这可能会给我一个暗示。瓦吉姆,这个联系让我找到了解决办法;我知道如何使用jboss-deployment-structure.xml,但没有按照建议使用imports元素。在springframework module.xml中添加了一些额外的模块后,我就开始运行了。只是想澄清一下:“也不能通过jboss deployment structure.xml配置”这句话是以前版本的老信息。现在它是可配置的,如本答案中的示例所示。
<module name="org.springframework.spring" meta-inf="export" export="true" />