Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

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

  1. #21

    Default

    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 at 01:51 PM.

  2. #22

    Default

    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?

  3. #23

    Default

    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 ?

  4. #24
    Join Date
    Aug 2010
    Location
    London
    Posts
    4

    Default 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?

  5. #25
    Join Date
    May 2011
    Posts
    11

    Default

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

  6. #26

    Default Use the Maven Shade plugin

    Quote 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

  7. #27
    Join Date
    May 2011
    Posts
    11

    Default

    Thanks a lot for your reply!

  8. #28
    Join Date
    Sep 2012
    Posts
    1

    Default

    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>

  9. #29
    Join Date
    Mar 2013
    Posts
    1

    Default

    This fixed the issue for me.

Posting Permissions

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