JBoss 7中的Spring模块 [英] Spring module in JBoss 7

查看:115
本文介绍了JBoss 7中的Spring模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to set up Spring 3.0.6 libraries as a module in JBoss 7.

我在modules/org/springframework/main中拥有所有的jar,以及以下module.xml

I have all of the jars in modules/org/springframework/main along with the following 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>

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

I added org.springframework to the Dependencies line in my MANIFEST.MF

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

When I deploy the app the following exception is thrown while parsing my spring-servlet.xml file (sorry, this is from a system that is not networked)

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

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

My first thought was that the module is not being used but if I remove org.springframework from my Dependencies line it fails to find org.springframework.web.context.ContextLoaderListener

如果将罐子放在WEB-INF/lib中而不使用模块,一切都可以正常工作.

Everything works fine if I put the jars in WEB-INF/lib instead of using the module.

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

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

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

so I put spring-beans-3.0.xsd in the same directory as spring-servlet.xml and modified the xml to

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

但仍然没有运气.

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

Anybody have an idea of why the class files are found but the xsd files are not?

推荐答案

以防万一,注释中给出的链接消失了,问题在于

Just in case the link that was given in the comments goes away, the problem is that

问题:

名称空间配置文件位于META-INF中,但是该目录 不可见(也无法通过配置 jboss-deployment-structure.xml)

The namespace configuration files are in META-INF, but that directory is not visible (nor is it configurable via 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>

这篇关于JBoss 7中的Spring模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆