Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Unable to locate NamespaceHandler when using context:annotation-config

  1. #1
    Join Date
    Aug 2004
    Posts
    230

    Default Unable to locate NamespaceHandler when using context:annotation-config

    From 2.0.2 thru the current 2.0.3 nightly I get a warning indicating that the "context" namespace handlers cannot be found.

    Code:
    Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]	domain-test.ctx.xml	ot_domain/src/test/conf/META-INF/spring	line 11
    This seems only to appear when my config file contains

    Code:
    <context:annotation-config />
    Its a strange error since the message does not indicate any issue with context:annotation-config element element -- the warning is bound the xsi:schemaLocation element.

    -barry
    Barry Kaplan (memelet)

  2. #2
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    Hi Barry,

    so it is nightly time for you ;-) Thanks for being on the bleeding edge and providing feedback.

    I just checked the SVN head and can't reproduce your problem with the missing NamespaceHandler for the context namespace. Can you please do a clean reinstallation of the latest nightly to see if this problem still persists?

    Its a strange error since the message does not indicate any issue with context:annotation-config element element -- the warning is bound the xsi:schemaLocation element.
    That is actually 'by desgin' as Spring core only reports the error with not finding the namespace handler on the root beans xml element. That is not very convenient. Maybe I can fix that in Spring core.

    Thanks,

    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  3. #3
    Join Date
    Feb 2008
    Posts
    1

    Default namespacehandler not found for <context:

    I get the same exception when including:

    <context:annotation-config />

    in my applicationContext.xml using other versions of all relevant jars... I know I've tried 2.0.5 and 2.0.6...

    Any help?
    Thanks
    M

  4. #4
    Join Date
    Dec 2007
    Location
    Santiago, Chile
    Posts
    20

    Unhappy Unable to locate Spring NamespaceHandler for element ....

    I have the same problem you have. I followed the instructions on installing the Spring IDE once you had a previous version installed: first, erase anything beginning with org.springframework from both plugins and features directories' in Eclipse; then install the latest Spring IDE with Eclipse Update Manager.

    After doing this, I started Eclipse with the -clean option. When doing this, the Spring elements shown in the Project Explorer view were all those defined in the context configuration file. But, once you close Eclipse and start it again in the normal way, say, with no -clean option, it will flag warnings on <context:annotation-config />, <jee:jndi-lookup /> and <tx:annotation-driven />, with the message "Unable to locate Spring NamespaceHandler for element 'tx:annotation-driven' of schema namespace 'http://www.springframework.org/schema/tx'" (this is for the tx case, the other ones display the corresponding XML tag name). The elements are flagged with warnings in the Eclipse XML Editor.

    If then you shut down and restart Eclipse again with the -clean option, the missing XML tags are shown in the Spring elements of the Project Explorer view. If you remove the Spring nature form the project, the warnings disappear. Also, the editor works well and is capable of identifying children and attributes for the XML tags, regardless of the warnings issued.

    This, to me, is a bug in the Spring XML schemas. But systems behaviour is so mysterious that I prefer not to speculate on the cause, rather leaving the solution to you.

  5. #5

    Unhappy Same Error using Maven 2.0.9 and JMetere

    Using spring-2.5.4 elements:

    I'm having the same issue. We have an application with JUnit Tests running in Eclipse using the same context files and it works fine. When I do a maven build with an assembly target for the JMeter Sampler I get:

    Unable to locate Spring NamespaceHandler for XML schema namespace
    When running the test from JMeter.

    Has anyone attempted to load applicationContexts within JMeter?

    Additional Information:

    I was able to create a JUnit Test and run outside of Eclipse using "mvn test". All the test did was load the context files.
    Last edited by nmaiorana; May 24th, 2008 at 03:43 PM.

  6. #6
    Join Date
    Jul 2008
    Posts
    5

    Default Same problem here

    Using maven 2.0.9, Spring 2.5.5.

    When building with maven, the test cases initializing the application context succeed.

    When starting the app (packaged as jar-with-dependencies by "mvn assembly:assembly") it fails giving the following error:

    Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [h ttp://w ww.springframework.org/schema/context]

    The context XML file starts with these lines:

    Code:
    <beans xmlns="ht tp://w ww.springframe work.org/schema/beans" xmlns:xsi="ht tp://ww w.w 3.org/2001/XMLSchema-instance"
    	xmlns:tx="ht tp://w ww.springframe work.org/schema/tx" xmlns:context="ht tp://w ww.springframe work.org/schema/context"
    	xmlns:jms="ht tp://w ww.springframe work.org/schema/jms" xmlns:aop="ht tp://w ww.springframe work.org/schema/aop"
    	xsi:schemaLocation="ht tp://w ww.springframe work.org/schema/beans 
    	ht tp://w ww.springframe work.org/schema/beans/spring-beans-2.0.xsd 
    	ht tp://w ww.springframe work.org/schema/tx 
    	ht tp://w ww.springframe work.org/schema/tx/spring-tx-2.0.xsd 
    	ht tp://w ww.springframe work.org/schema/context
    	ht tp://w ww.springframe work.org/schema/context/spring-context-2.5.xsd 
    	ht tp://w ww.springframe work.org/schema/jms 
    	ht tp://w ww.springframe work.org/schema/jms/spring-jms-2.1.xsd
    	ht tp://w ww.springframe work.org/schema/aop
        ht tp://w ww.springframe work.org/schema/aop/spring-aop.xsd">
    
    	<context:annotation-config />

  7. #7
    Join Date
    Jul 2008
    Location
    Münster, Germany
    Posts
    1

    Default Use other assembly types

    I'm having this error too when packaging my application with Maven into a single file release. The funny thing is, when I use a descriptor like:

    Code:
    <assembly>
        <id>bin</id>
        <formats>
            <format>zip</format>
        </formats>
        <fileSets>
            <fileSet>
                <directory>target</directory>
                <outputDirectory></outputDirectory>
                <includes>
                    <include>*.jar</include>
                </includes>
            </fileSet>
        </fileSets>
        <dependencySets>
            <dependencySet>
                <outputDirectory>lib/</outputDirectory>
                <unpack>false</unpack>
                <scope>runtime</scope>
            </dependencySet>
        </dependencySets>
    </assembly>
    that generates a zip file with a collection of jars, I can run the application by building a classpath from all the jars in the zip and using it to run

    java -cp $myClasspath com.foo.Application

    This leads me to believe that the real problem behind this issue is the way the "fat jar" is created by Maven. Maybe some classes are duplicate and get overwritten in the wrong order or the classloader loads them in the wrong order for the program to run correctly.

  8. #8
    Join Date
    Jul 2008
    Posts
    5

    Default Reason found (?)

    I found the reason for the error here

    ht tp://bit.ly/2qx1Ax

    (Sorry, had to obfusecate the URL to make this forum accept my post. Just correct the "http" and it should work.)

    The Assembly plugin unzips every jar before putting the content into one big jar. Instead of concatenating the entries in META-INF/spring.handlers and META-INF/spring.schemas of the spring*.jar's it always overwrites. The spring.schemas and spring.handlers files of the last processed jar "win" and will be included in the big jar.

    One solution is to create those two files manually and put them into the assembled jar.

  9. #9
    Join Date
    Jul 2008
    Posts
    3

    Default Same problem

    I'm also getting these same warnings. Clean install of Eclipse 3.4 for JEE, nightly release of Spring IDE 2.1, clean workspace, new project.

    If I create a file with config directly out of the Spring Security manual (spaces added to URLs changed to comply with posting rules):

    Code:
    <beans:beans xmlns="h ttp://w ww.springframework.org/schema/security"
    	xmlns:beans="h ttp://ww w.springframework.org/schema/beans">
    	<http auto-config='true'>
    		<intercept-url pattern="/**" access="ROLE_USER" />
    	</http>
    </beans:beans>
    I consistently get the same warning:

    Code:
    Unable to locate Spring NamespaceHandler for element 'http' of schema namespace 'h ttp://ww w.springframework.org/schema/security'
    Does nobody have any idea how to solve this?

    - rich

  10. #10
    Join Date
    Aug 2006
    Location
    Melbourne, Victoria, Australia
    Posts
    55

    Default

    I'm getting the same error:

    Code:
    Unable to locate Spring NamespaceHandler for element 'authentication-provider' of schema namespace 'http://www.springframework.org/schema/security'
    and

    Code:
    Unable to locate Spring NamespaceHandler for element 'http' of schema namespace 'http://www.springframework.org/schema/security'
    my context file:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <s:beans xmlns="http://www.springframework.org/schema/security" xmlns:s="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
      
      <http auto-config='true'>
        <intercept-url pattern="/**" access="ROLE_USER" />
      </http>
      
      <authentication-provider>
        <user-service>
          <user name="jimi" password="jimispassword" authorities="ROLE_USER, ROLE_ADMIN" />
          <user name="bob" password="bobspassword" authorities="ROLE_USER" />
        </user-service>
      </authentication-provider>
    </s:beans>
    Quote Originally Posted by raston View Post
    I'm also getting these same warnings. Clean install of Eclipse 3.4 for JEE, nightly release of Spring IDE 2.1, clean workspace, new project.

    If I create a file with config directly out of the Spring Security manual (spaces added to URLs changed to comply with posting rules):
    ...
    Does nobody have any idea how to solve this?

    - rich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •