JBoss 7中的Spring模块

Mar*_*und 8 jboss spring jboss7.x

我正在尝试将Spring 3.0.6库设置为JBoss 7中的模块.

我有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.RELEASE.jar"/>
          ...
    </resources>

    <dependencies>
       <module name="javax.api"/>
       <module name="javax.servlet.api"/>
       <module name="org.apache.commons.logging"/>
    </dependencies>
</module>
Run Code Online (Sandbox Code Playgroud)

org.springframework在MANIFEST.MF中添加了Dependencies行

当我部署应用程序时,在解析我的spring-servlet.xml文件时抛出以下异常(抱歉,这是来自未联网的系统)

SAXParseException: ... Cannot find the declaration of element 'beans'
Run Code Online (Sandbox Code Playgroud)

我的第一个想法是该模块没有被使用,但如果我org.springframework从我的Dependencies行中删除它无法找到org.springframework.web.context.ContextLoaderListener

如果我把罐子放在WEB-INF/lib而不是使用模块,一切正常.

spring-servlet.xml 包含以下架构参考

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
Run Code Online (Sandbox Code Playgroud)

所以我把xml 放在spring-beans-3.0.xsd同一个目录中spring-servlet.xml并将其修改为

http://www.springframework.org/schema/beans spring-beans-3.0.xsd
Run Code Online (Sandbox Code Playgroud)

但仍然没有运气.

任何人都知道为什么找到类文件但是xsd文件不是?

Mar*_*und 5

为了防止评论中给出的链接消失,问题就在于此

问题:

命名空间配置文件在META-INF中,但该目录不可见(也不能通过jboss-deployment-structure.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>
Run Code Online (Sandbox Code Playgroud)

  • 只是为了澄清:评论"也不能通过jboss-deployment-structure.xml配置"是来自先前版本的旧信息.现在它是可配置的,就像这个答案中的例子所示. (3认同)