spring配置文件异常

阅读更多
100817 141034 INFO AbstractApplicationContext.java:411 Refreshing org.springfram
ework.context.support.ClassPathXmlApplicationContext@1f9dc36: display name [org.
springframework.context.support.ClassPathXmlApplicationContext@1f9dc36]; startup
 date [Tue Aug 17 14:10:34 CST 2010]; root of context hierarchy
100817 141034 INFO XmlBeanDefinitionReader.java:323 Loading XML bean definitions
 from class path resource [context-common-default.xml]
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinit
ionParsingException: Configuration problem: Unable to locate Spring NamespaceHan
dler for XML schema namespace [http://www.springframework.org/schema/tx]
Offending resource: class path resource [context-common-default.xml]

        at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:68)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:85)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:80)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er
ror(BeanDefinitionParserDelegate.java:281)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa
rseCustomElement(BeanDefinitionParserDelegate.java:1294)

问题原因:打包之后,jar包中META-INF目录包含了多个spring的spring.schemas文件,该文件引导有先后顺序,导致无法处理http://www.springframework.org/schema/tx的schema。
解决办法:
将原先的spring分包依赖:

			org.springframework
			spring-aop
		
		
			org.springframework
			spring-beans
		
		
			org.springframework
			spring-context
		
		
			org.springframework
			spring-context-support
		
		
			org.springframework
			spring-core
		
		
			org.springframework
			spring-jdbc
		
		
			org.springframework
			spring-tx
		
		
			org.springframework
			spring-web
		
		
			org.springframework
			spring-webmvc
		
		
			org.springframework
			spring-test
			test
		

改用以下单个包:

			org.springframework
			spring
		

ok pass.备忘!

你可能感兴趣的:(Spring,Java,XML,AOP,Bean)