简体   繁体   中英

getting 'Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]' with spring 4

I am upgrading spring versions of our OSGi project to spring 4.2.x.

I have removed Spring DM dependencies and add Gemini Blueprint dependencies ( org.eclipse.gemini.blueprint.core , org.eclipse.gemini.blueprint.extender , org.eclipse.gemini.blueprint.io ) and those are in ACTIVE state in Virgo RT server.
I have added spring-security-config dependency and it is also in ACTIVE state.

But I am facing following issue

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [ http://www.springframework.org/schema/security] Offending resource: URL [bundleentry://157.fwk1212103909/META-INF/spring/applicationContext-security.xml]

my applicationContext-security.xml file is like this

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:security="http://www.springframework.org/schema/security"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security.xsd">

  <security:global-method-security pre-post-annotations="enabled" run-as-manager-ref="runAsManager"
secured-annotations="enabled">
    <security:expression-handler ref="expressionHandler" />
  </security:global-method-security> 

  ... 

</beans>

I have used the xsd with versions. same result.

any idea what is causing this issue?

It would help if you stated which version of Virgo you are using. Are you aware of the fact that Virgo 3.7.0 includes Spring 4?

我必须在项目中的META-INF / spring.handlers文件中添加以下行。

http\://www.springframework.org/schema/security=org.springframework.security.config.SecurityNamespaceHandler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM