您的位置:首页 > 理论基础 > 计算机网络

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/sc

2015-10-18 15:20 891 查看


Unable
to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop]






up
vote0down
votefavorite

1

I m using Spring AOP architecture for Logging and Transaction management.we are using WSO2-ESB container
for deploying our service. Here the XML file which we try to read usingClassPathXmlApplicationContext().
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <!-- Complete AOP implementation -->
<aop:aspectj-autoproxy />
<!-- Aspect -->
<bean id="logAspect" class="x.y.z.logging.aspect.LoggingAspect" />
<aop:config>
<aop:aspect id="aspectLoggging" ref="logAspect" >
<!-- @Before -->
<aop:pointcut id="pointCutBefore"
expression="execution(* *(..))" />
<aop:before method="logBefore" pointcut-ref="pointCutBefore" />
<!-- @After -->
<aop:pointcut id="pointCutAfter"
expression="execution(* *(..))" />
<aop:after method="logAfter" pointcut-ref="pointCutAfter" />
<!-- @AfterReturning -->
<aop:pointcut id="pointCutAfterReturning"
expression="execution(* *(..))" />
<aop:after-returning method="logAfterReturning" returning="result"
pointcut-ref="pointCutAfterReturning" />
<!-- @AfterThrowing -->
<aop:pointcut id="pointCutAfterThrowing"
expression="execution(* *(..))" />
<aop:after-throwing method="logAfterThrowing" throwing="error"
pointcut-ref="pointCutAfterThrowing"  />
</aop:aspect>
</aop:config>
</beans>


Actual problem occurred when i start my WSO2-ESB server. Here i have attached Stacktrace :
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop]
Offending resource: file [C:\WSO2\Temp\WSO2ES~1.0\.\repository\conf\bundle-config\logger-aspect.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at com.mi.logging.core.SpringLoggerUtil.setApplicationContext(SpringLoggerUtil.java:37)
at com.mi.logging.aspect.activator.LogAspectActivator.start(LogAspectActivator.java:16)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
... 9 more


I m using spring.3.2.5 version and I have reassured that all dependent jar are on classpath. Please help to resolve this issue. If you have any suggestion or solution then please let me know. Thnx in advance.

spring wso2esb spring-aop
shareimprove
this question
asked Jan 20 '14 at 7:45





Tejas Patel
39111

 
 
I would say that there is no spring-aop.jar (or wrong version) on the classpath. Or it isn't readable. – M.
Deinum Jan
20 '14 at 9:39
 
spring-aop-3.2.5.RELEASE.jar is in the classpath and have the correct version. If you have any reference
or samples of Spring AOP implementation in WSO2-ESB then please share it. – Tejas
Patel Jan
20 '14 at 10:31
 
When is it on the classpath, during building or during deployment? – M.
Deinum Jan
20 '14 at 11:13
 
we have used Maven for dependency management, so at build time osgi bundle resolve dependency from maven repository.But while deployment time, WSO2 ESB container provide
the required jar files so it resolve dependency from there. I m using the same version at both side. – Tejas
Patel Jan
20 '14 at 11:55
add
a comment


1 Answer

activeoldestvotes

up vote0down
voteaccepted
This problem occurred due to it can't find the path/location of spring-aop-3.0.xsd fromspring.framework_3.1.0.wso2v1.jar,
which is provided by the WSO2-ESB.

It can be resolved by two ways : 

1) You can add your latest version of spring and set the priority of that jar files.
Reference

2) You have to just simply follow the steps described below. You have to add some files into META-INF folder of spring.framework_3.1.0.wso2v1.jar file.

Steps are shown below. 

i) Create a new file spring.schemas and add the content shown below.
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.2.xsd


ii) Create a new file spring.handlers and add the content shown below.
http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler


iii) Create a new file spring.tooling and add the content shown below.
# Tooling related information for the aop namespace
http\://www.springframework.org/schema/aop@name=aop Namespace
http\://www.springframework.org/schema/aop@prefix=aop
http\://www.springframework.org/schema/aop@icon=org/springframework/aop/config/spring-aop.gif


shareimprove
this answer
edited Jan
21 '14 at 7:13

answered Jan 21 '14 at 6:35





Tejas Patel
39111

 add
a comment
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: