配置问题:找不到春天NamespaceHandler XML模式命名空间[http://www.springframework.org/schema/tx]

问题描述:

在JBoss服务器启动时,我得到这个错误,配置问题:找不到春天NamespaceHandler XML模式命名空间[http://www.springframework.org/schema/tx]

19:44:59,307 ERROR [STDERR] 23813 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
19:44:59,307 ERROR [STDERR] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx] 
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml] 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287) 
19:44:59,307 ERROR [STDERR]  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) 

这该怎么我的application.xml中的样子,

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> 

我使用弹簧2.5.6 ...上的错误有任何建议..

+0

你如何部署你的web应用服务器? – Luciano 2012-08-08 14:29:44

+0

Luciano我正在处理我的.ear文件并将其粘贴到\ jboss-5.1.0.GA-jdk6 \ jboss-5.1.0.GA \ server \ default \ deploy文件夹,然后从eclipse启动maven服务器。 – 2012-08-08 14:33:15

+0

“然后从eclipse启动maven服务器“?你到底意味着什么? – 2012-08-08 14:43:19

这可能是因为你缺少spring-tx*.jar文件在您classpa日。你可以验证这个文件是否在类路径中。

以备将来参考:

如果您正在使用Maven,也许你忘了春天-TX的依赖。

<dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-tx</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 

问候