8

我正在尝试将 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>

我添加org.springframework到 MANIFEST.MF 的 Dependencies 行

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

SAXParseException: ... Cannot find the declaration of element 'beans'

我的第一个想法是该模块没有被使用,但是如果我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

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

http://www.springframework.org/schema/beans spring-beans-3.0.xsd

但仍然没有运气。

有人知道为什么找到类文件但找不到xsd文件吗?

4

2 回答 2

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>
于 2012-05-11T13:48:22.590 回答
0

面临着完全相同的问题。在 JBoss 7 上设置了一个 spring 模块,然后在部署我的应用程序时,面临以下警告:

无法读取架构文档“ http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

在阅读了上面评论中的链接后,我了解到 spring 上下文文件无法从 spring jar 中访问模式定义。因此,该应用程序没有得到部署。但是那里给出的解决方案对我不起作用。但是 jboss-deployment-structure.xml 中的以下代码解决了这个问题。

解决方案

<module name="org.springframework.spring"   meta-inf="export"   export="true" />

添加meta-inf="export"属性。

于 2015-12-02T06:23:13.633 回答