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

  • #16
    Hi Christian, Rich, Vasily,

    I tried 2.1.1.v200808042008 nightly build and it works fine without namespace warnigs.
    BTW, I found no bean in Spring Elements tree in Project Exploler that is declared as security namespace such as <security:http/>. How about yours?

    Regards,
    Matsuzaka

    Comment


    • #17
      Hackish workaround

      I have a rather hackish workaround for my special problem with maven-assembly-plugin not concatenating spring.handlers and spring.schemas in the generated jar-with-dependencies.

      I created those two files manually and put

      Code:
      <fileSet>
      	<directory>target/classes</directory>
      	<outputDirectory>META-INF</outputDirectory>
      	<includes>
      		<include>spring.handlers</include>
      		<include>spring.schemas</include>
      	</includes>
      </fileSet>
      in my assembly descriptor to put them into META-INF of the final jar. Not a very clean solution, but it works for now.

      Comment


      • #18
        Code:
        Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
        i have this trouble and still dont know how to solve..

        im using spring 2.5.6.

        what i have to do to fix that?? plz help me..

        Comment


        • #19
          below its my configuration xml

          Code:
          <beans xmlns="http://www.springframework.org/schema/beans"
          		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          		xmlns:context="http://www.springframework.org/schema/context"
          		xmlns:aop="http://www.springframework.org/schema/aop"
          		xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
          
          	<context:load-time-weaver/>

          help!

          Comment


          • #20
            I'm still getting these warnings in Eclipse!

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

            Code:
            <beans:beans xmlns="http://www.springframework.org/schema/security"
            	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
            	xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security"
            	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
            	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 
            	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
            	http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
            
            	<http auto-config="true">
            		...
            	</http>
            Eclipse Galileo, SpringIDE 2.2.6

            Comment


            • #21
              I am seeing the same warning in IDE version 2.2.7.
              The particular context.xml file which's causing the warning doesn't contain the <annotation-config /> clause.

              Here is the warning:
              Unable to locate Spring NamespaceHandler for element 'flex:message-destination' of schema namespace 'http://www.springframework.org/schema/flex' flex-context.xml /flex-test.web/src/main/resources/META-INF/spring line 23 Spring Beans Problem
              Last edited by candy.chiu.ad; Oct 24th, 2009, 02:51 PM.

              Comment


              • #22
                I am getting the same thing. And if I am not connected to the internet I get the following list of errors.

                Code:
                Multiple annotations found at this line:
                	- Unable to locate Spring NamespaceHandler for element 'flex:remoting-destination' of schema namespace 'http://www.springframework.org/schema/flex'
                	- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'flex:remoting-destination'.
                	- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/flex/spring-flex-1.0.xsd', because 1) could not find the document; 2) the document could not be 
                	 read; 3) the root element of the document is not <xsd:schema>.
                I believe this has to do with the schema not being a part of the SpringSource Tool Suite plugin/install. I tried adding the jar and that didn't work. I also tried to point the XML catalog in eclipse to the schema but that didn't work either.

                Does anyone know how to fix this?

                Comment


                • #23
                  Solution for the spring security issue.
                  -Create folder called META-INF in project folder, project-war-folder->WEB-INF->clasess/META-INF/
                  -Copy schema mappings from security-core/META-INF to your newly created folder.

                  Works for me. Not the prettiest solution but works, so why should we bother ?

                  Comment


                  • #24
                    Avoid conflict of spring.handlers/spring.schemas when merging dependencies in one jar

                    I ran into the "Unable to locate NamespaceHandler when using context:annotation-config" error using the maven-assembly-plugin to generate a runnable jar with all the dependencies included. As other people correctly spotted in this thread Spring can't resolve the namespace handler because multiple jars contain the files META-INF/spring.handlers and META-INF/spring.schemas
                    . When the maven-assembly-plugin repackages the jars in a single file the files with the same name are overwritten, therefore we'll have only the ones in the last file.

                    Looking at the content of two spring-*.jar files you can see the files sits in the same position in the classpath

                    Code:
                    $ jar tf spring-oxm-3.0.3.RELEASE.jar
                    META-INF/spring.handlers
                    META-INF/spring.schemas
                    org/springframework/
                    org/springframework/oxm/
                    org/springframework/oxm/GenericMarshaller.class
                    ...
                    
                    $ jar tf spring-context-3.0.3.RELEASE.jar
                    META-INF/spring.handlers
                    META-INF/spring.schemas
                    META-INF/spring.tooling
                    org/
                    org/springframework/
                    org/springframework/context/
                    org/springframework/context/ApplicationContext.class
                    org/springframework/context/ApplicationContextAware.class
                    I think it is possible to put the META-INF folder in any package, so the idea I'd suggest, (hope it's applicable) is to put each spring.shemas/.handlers file under the package they refer to.

                    Code:
                    $ jar tf spring-oxm-3.0.3.RELEASE.jar
                    org/springframework/
                    org/springframework/oxm/META-INF/spring.schemas
                    org/springframework/oxm/META-INF/spring.handlers
                    org/springframework/oxm/GenericMarshaller.class
                    ...
                    
                    $ jar tf spring-context-3.0.3.RELEASE.jar
                    org/
                    org/springframework/
                    org/springframework/context/META-INF/spring.handlers
                    org/springframework/context/META-INF/spring.schemas
                    org/springframework/context/ApplicationContext.class
                    org/springframework/context/ApplicationContextAware.class
                    This way they won't conflict... what do you think about it?

                    Comment


                    • #25
                      I'm having the same issue xan is talking about. Anybody got a solution for it?

                      Comment


                      • #26
                        Use the Maven Shade plugin

                        Originally posted by fwachs View Post
                        I'm having the same issue xan is talking about. Anybody got a solution for it?
                        Ditch the Assembly plugin and use the Maven Shade plugin. It's easier to use, more powerful, and (for me) has less bugs. There's an example for this exact use case:
                        http://maven.apache.org/plugins/mave...ingTransformer

                        Comment


                        • #27
                          Thanks a lot for your reply!

                          Comment


                          • #28
                            It worked for me when I put the followings in the pom.xml file ..


                            <build>
                            <plugins>
                            <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-shade-plugin</artifactId>
                            <executions>
                            <execution>
                            <phase>package</phase>
                            <goals>
                            <goal>shade</goal>
                            </goals>
                            <configuration>
                            <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.res ource.AppendingTransformer">
                            <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.res ource.AppendingTransformer">
                            <resource>META-INF/spring.schemas</resource>
                            </transformer>
                            </transformers>
                            </configuration>
                            </execution>
                            </executions>
                            </plugin>
                            </plugins>
                            </build>

                            Comment


                            • #29
                              This fixed the issue for me.

                              Comment

                              Working...
                              X