您的位置:首页 > 编程语言 > Java开发

Unable to locate Spring NamespaceHandler for XML

2014-12-25 11:39 337 查看
工程在本地Eclipse中运行没任何问题, 打成jar包后启动报错!

Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util]

Offending resource: class path resource [appcontext.xml]

上网一顿搜索

发现有童鞋跟我遇到一样的问题:
http://chenzhou123520.iteye.com/blog/1971322 http://iteches.com/archives/34439
我的Spring配置文件头文件如下:

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
然后打好的jar包 META-INF下果然发现spring.handlers和spring.schemas

我将spring.handlers解压出来,打开一看,,里面只有1行

http\://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler

很明显,我的头文件中用了util这玩意,,so,,我在下面加了一行

http\://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler

让保存,,替换到jar中..重启,,问题解决!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐