Announcement Announcement Module
Collapse
No announcement yet.
spring oauth names space issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring oauth names space issue

    Hi,

    I have been trying to troubleshoot this error for a while with no luck so far, please let me know what I am missing or if you have any idea of what the problem is:

    When I deploy my application, I get the following error:

    ERROR ContextLoader:219 - Context initialization failed
    org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler fo
    r XML schema namespace [http://www.springframework.org/schema/security/oauth]
    Offending resource: class path resource [applicationContext-security.xml]

    at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :68)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:80)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.error(BeanDefinitionParserDelegat e.java:284)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1332)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1325)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReade
    r.java:136)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentRe
    ader.java:93)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:390)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:302)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:93) at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContex
    t.java:130)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:465)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:395)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)

    My dependencies for spring, ss and ss oauth in the pom follow, using:

    <spring.framework.version>3.0.5.RELEASE</spring.framework.version>
    <spring.security.version>3.0.3.RELEASE</spring.security.version>

    Code:
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-jdbc</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-oxm</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-aop</artifactId>
          <version>${spring.framework.version}</version>
        </dependency>
        
        <!--  Spring Security -->
        <dependency>
    		<groupId>org.springframework.security</groupId> 
            <artifactId>spring-security-core</artifactId> 
            <version>${spring.security.version}</version> 
        </dependency>
        <dependency>
    		<groupId>org.springframework.security</groupId> 
            <artifactId>spring-security-web</artifactId> 
            <version>${spring.security.version}</version> 
        </dependency>
        <dependency>
    		<groupId>org.springframework.security</groupId> 
            <artifactId>spring-security-config</artifactId> 
            <version>${spring.security.version}</version> 
        </dependency>
        <dependency>
        	<groupId>org.codehaus.spring-security-oauth</groupId>
        	<artifactId>spring-security-oauth</artifactId>
        	<version>3.19.SS3</version>
        </dependency>
    my spring security context file is using the following name space definitions:

    Code:
    <beans:beans xmlns="http://www.springframework.org/schema/security"
      xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:oauth="http://www.springframework.org/schema/security/oauth"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                  http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
                  http://www.springframework.org/schema/security/oauth http://www.springframework.org/schema/security/spring-security-oauth.xsd">
    I am also getting a warning in eclipse that might or might not be related to the issue... but in case this is another clue:

    Description Resource Path Location Type
    Unable to locate Spring NamespaceHandler for element 'oauthrovider' of schema namespace 'http://www.springframework.org/schema/security/oauth' applicationContext-security.xml /<myappname>/src/main/resources line 25 Spring Beans Problem

    Thanks for any help in advance!

  • #2
    Re: spring oauth names space issue

    If you depend on the codehaus artifact, you need to use the codehaus namespace. So you either need to change the namespace to this:

    Code:
    <beans:beans xmlns="http://www.springframework.org/schema/security" 
      xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:oauth="http://spring-security-oauth.codehaus.org/3.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
        http://spring-security-oauth.codehaus.org/3.0 http://spring-security-oauth.codehaus.org/schema/spring-security-oauth-3.0.xsd">
    Or you need to depend on the springsource artifact:

    Code:
        <dependency>
          <groupId>org.springframework.security.oauth</groupId>
          <artifactId>spring-security-oauth</artifactId>
          <version>1.0.0.M1</version>
        </dependency>
    instead of the codehaus artifact.

    Comment


    • #3
      Thanks, that fixed the issue.

      I was following the documentation on the new site and the latest stable release for SS3 is not really springframework owned yet so that caused the confussion.

      -X

      Comment

      Working...
      X