Announcement Announcement Module
Collapse
No announcement yet.
Unable to locate NamespaceHandler when using context:annotation-config Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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

    Comment


    • #3
      namespacehandler not found for &lt;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

      Comment


      • #4
        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.

        Comment


        • #5
          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, 04:43 PM.

          Comment


          • #6
            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 />

            Comment


            • #7
              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.

              Comment


              • #8
                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.

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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>
                    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

                    Comment


                    • #11
                      The two threads about "Unable to locate Spring NamespaceHandler" on this fourm have had over 5000 views so this obviously quite a common problem. Is there an issue open for it in JIRA?

                      Cheers, Rich.

                      Comment


                      • #12
                        Hey,

                        I just tested 2.1 installed into a plain Eclipse 3.4 JEE package and can't reproduce this problem.

                        Are you guys installing Spring IDE's OSGi extension? Please also check if you have more than one spring security bundle in your plugins directory. Please note that the bundle has been renamed from org.springframework.bundle.security.core to org.springframework.security.core. Eventually delete those old bundles.

                        Furthermore it would be very interesting to get the OSGi bundle status. Please start your Eclipse with "eclipse -console" and post the output of "ss org.springframework" into this thread.

                        Lets try to solve this problem.

                        Christian
                        Last edited by Christian Dupuis; Aug 2nd, 2008, 11:55 AM.

                        Comment


                        • #13
                          Hi Christian,

                          Thanks for the reply! I've got a bit closer to solving my problem. Now with a clean Eclipse 3.4 JEE and the new released Spring IDE 2.1 (Core, Security Extension and OSGi Extension) I no longer get the warnings.

                          (By the way is the OSGi extension required in order for the Security one to work?)

                          I then tried to get the working with my main Eclipse 3.3 installation. I removed all Spring featuers and plugins and re-installed Spring IDE 2.1 but I am still getting the warnings.

                          Here is my console output:

                          Code:
                          osgi> ss org.springframework
                          
                          Framework is launched.
                          
                          id	State       Bundle
                          625	RESOLVED    org.springframework.bundle.osgi.core_1.1.0.v200807062000
                          626	RESOLVED    org.springframework.bundle.osgi.doc_1.0.0.v200801251000
                          627	ACTIVE      org.springframework.bundle.osgi.extender_1.1.0.v200807062000
                          628	RESOLVED    org.springframework.bundle.osgi.io_1.1.0.v200807602000
                          629	RESOLVED    org.springframework.bundle.spring.doc_2.5.6.v200807062000
                          630	RESOLVED    org.springframework.bundle.spring_2.5.6.v200807062000
                          631	ACTIVE      org.springframework.ide.eclipse.beans.core_2.1.0.v200808011800
                          632	ACTIVE      org.springframework.ide.eclipse.beans.osgibridge_2.1.0.v200808011800
                          633	ACTIVE      org.springframework.ide.eclipse.beans.ui.editor_2.1.0.v200808011800
                          634	<<LAZY>>    org.springframework.ide.eclipse.beans.ui.graph_2.1.0.v200808011800
                          635	<<LAZY>>    org.springframework.ide.eclipse.beans.ui.refactoring_2.1.0.v200808011800
                          636	<<LAZY>>    org.springframework.ide.eclipse.beans.ui.search_2.1.0.v200808011800
                          637	ACTIVE      org.springframework.ide.eclipse.beans.ui_2.1.0.v200808011800
                          638	ACTIVE      org.springframework.ide.eclipse.core_2.1.0.v200808011800
                          639	<<LAZY>>    org.springframework.ide.eclipse.doc_2.1.0.v200808011800
                          640	<<LAZY>>    org.springframework.ide.eclipse.osgi.targetdefinition_2.1.0.v200808011800
                          641	<<LAZY>>    org.springframework.ide.eclipse.osgi_2.1.0.v200808011800
                          642	INSTALLED   org.springframework.ide.eclipse.security_2.1.0.v200808011800
                          643	ACTIVE      org.springframework.ide.eclipse.ui_2.1.0.v200808011800
                          644	RESOLVED    org.springframework.ide.eclipse_2.1.0.v200808011800
                          645	RESOLVED    org.springframework.osgi.backport.util.concurrent_3.0.0
                          646	INSTALLED   org.springframework.security.annotation_2.0.4.v200807280800
                          647	INSTALLED   org.springframework.security.core_2.0.4.v200807280800
                          
                          osgi>
                          With these features installed:

                          Code:
                          iMac:features rich$ ls -al | grep spring
                          drwxr-xr-x    6 rich  admin   204  4 Aug 09:33 org.springframework.ide.eclipse.feature_2.1.0.v200808011800
                          drwxr-xr-x    6 rich  admin   204  4 Aug 09:33 org.springframework.ide.eclipse.osgi.feature_2.1.0.v200808011800
                          drwxr-xr-x    6 rich  admin   204  4 Aug 09:33 org.springframework.ide.eclipse.security.feature_2.1.0.v200808011800
                          iMac:features rich$
                          And these plugins:

                          Code:
                          iMac:plugins rich$ ls -al | grep spring
                          -rw-r--r--    1 rich  admin   297543  4 Aug 09:33 org.springframework.bundle.osgi.core_1.1.0.v200807062000.jar
                          -rw-r--r--    1 rich  admin  1062664  4 Aug 09:33 org.springframework.bundle.osgi.doc_1.0.0.v200801251000.jar
                          -rw-r--r--    1 rich  admin    91232  4 Aug 09:33 org.springframework.bundle.osgi.extender_1.1.0.v200807062000.jar
                          -rw-r--r--    1 rich  admin    29412  4 Aug 09:33 org.springframework.bundle.osgi.io_1.1.0.v200807602000.jar
                          -rw-r--r--    1 rich  admin  2444385  4 Aug 09:33 org.springframework.bundle.spring.doc_2.5.6.v200807062000.jar
                          -rw-r--r--    1 rich  admin  2911119  4 Aug 09:33 org.springframework.bundle.spring_2.5.6.v200807062000.jar
                          -rw-r--r--    1 rich  admin   289376  4 Aug 09:33 org.springframework.ide.eclipse.beans.core_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    12723  4 Aug 09:33 org.springframework.ide.eclipse.beans.osgibridge_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin   226813  4 Aug 09:33 org.springframework.ide.eclipse.beans.ui.editor_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    75759  4 Aug 09:33 org.springframework.ide.eclipse.beans.ui.graph_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    52880  4 Aug 09:33 org.springframework.ide.eclipse.beans.ui.refactoring_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    48669  4 Aug 09:33 org.springframework.ide.eclipse.beans.ui.search_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin   313464  4 Aug 09:33 org.springframework.ide.eclipse.beans.ui_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin   182787  4 Aug 09:33 org.springframework.ide.eclipse.core_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin     1436  4 Aug 09:33 org.springframework.ide.eclipse.doc_2.1.0.v200808011800.jar
                          drwxr-xr-x    9 rich  admin      306  4 Aug 09:33 org.springframework.ide.eclipse.osgi.targetdefinition_2.1.0.v200808011800
                          -rw-r--r--    1 rich  admin    17452  4 Aug 09:33 org.springframework.ide.eclipse.osgi_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    18746  4 Aug 09:33 org.springframework.ide.eclipse.security_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin   151155  4 Aug 09:33 org.springframework.ide.eclipse.ui_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin    16430  4 Aug 09:33 org.springframework.ide.eclipse_2.1.0.v200808011800.jar
                          -rw-r--r--    1 rich  admin   331716  4 Aug 09:33 org.springframework.osgi.backport.util.concurrent_3.0.0.jar
                          -rw-r--r--    1 rich  admin     8435  4 Aug 09:33 org.springframework.security.annotation_2.0.4.v200807280800.jar
                          -rw-r--r--    1 rich  admin   753147  4 Aug 09:33 org.springframework.security.core_2.0.4.v200807280800.jar
                          iMac:plugins rich$
                          As you can see org.springframework.security.core is in there but seems not to be working. Any ideas?

                          Cheers, Rich.

                          Comment


                          • #14
                            Hi Christian,

                            Still getting those warnings with new Spring 2.1 IDE installed (no OSGi) on Eclipse 3.4.0:

                            Code:
                            Unable to locate Spring NamespaceHandler for element 'authentication-manager' of schema namespace 'http://www.springframework.org/schema/security'
                            Unable to locate Spring NamespaceHandler for element 'authentication-provider' of schema namespace 'http://www.springframework.org/schema/security'
                            Unable to locate Spring NamespaceHandler for element 'http' of schema namespace 'http://www.springframework.org/schema/security'
                            Also I've added these lines to my config file:
                            Code:
                            <authentication-manager alias="authenticationManager" />
                              <beans:bean class="org.springframework.security.ui.preauth.j2ee.J2eePreAuthenticatedProcessingFilter">
                                <custom-filter position="PRE_AUTH_FILTER" />
                                <beans:property name="authenticationManager" ref="authenticationManager" />
                            ...
                            and I'm getting this warning:

                            Code:
                            Referenced bean 'authenticationManager' not found
                            This is the list of Spring IDE files in my plugin directory:
                            org.springframework.ide.eclipse.security.source_2. 1.0.v200808011800
                            org.springframework.ide.eclipse.security_2.1.0.v20 0808011800.jar
                            org.springframework.security.annotation_2.0.4.v200 807280800.jar
                            org.springframework.security.core_2.0.4.v200807280 800.jar


                            and features:
                            org.springframework.ide.eclipse.security.feature.s ource_2.1.0.v200808011800
                            org.springframework.ide.eclipse.security.feature_2 .1.0.v200808011800


                            Although Spring IDE reports all these warning my application works correctly.

                            Thank you,
                            Vasily

                            Originally posted by Christian Dupuis View Post
                            Hey,

                            I just tested 2.1 installed into a plain Eclipse 3.4 JEE package and can't reproduce this problem.

                            Are you guys installing Spring IDE's OSGi extension? Please also check if you have more than one spring security bundle in your plugins directory. Please note that the bundle has been renamed from org.springframework.bundle.security.core to org.springframework.security.core. Eventually delete those old bundles.

                            Furthermore it would be very interesting to get the OSGi bundle status. Please start your Eclipse with "eclipse -console" and post the output of "ss org.springframework" into this thread.

                            Lets try to solve this problem.

                            Christian

                            Comment


                            • #15
                              Rich, Vasily,

                              thanks for the very detailed feedback.

                              (By the way is the OSGi extension required in order for the Security one to work?)
                              Yes, the OSGi extension is required but that is not indicated during install or in documentation. Furthermore there is no hard technical reason for this dependency. I created a bug to fix this:

                              IDE-914: Security plugin should not rely on existence of the OSGi plugin to install NamespaceHandler
                              http://jira.springframework.org/browse/IDE-914

                              Can you guys please test the upcoming nightly build. There are no other changes in that build besides this fix for the fore-mentioned bug. So it should be safe to install.

                              @Rich: I don't have any clue why your Eclipse 3.3 is showing the problems as the bundle status looks just fine. Can you try the upcoming nightly as well please.

                              Let me know if that helps.

                              Christian

                              Comment

                              Working...
                              X