Announcement Announcement Module
Collapse
No announcement yet.
Unable to locate Spring NamespaceHandler for XML schema namespace /schema/context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to locate Spring NamespaceHandler for XML schema namespace /schema/context

    Hi,

    I'm using Spring 2.5.5 & Maven 2.0.9.

    I'm using the maven assembly plugin (jar-with-dependencies) to generate a single assembly (in jar format). Since i'm using the "jar-with-dependencies", all dependencies are extracted to the final jar.

    Problem:
    When I start my application, I get an error as below.

    Initially the problem was occurring because i was using version 2.2-beta-1 of maven-assembly-plugin, which doesnt correctly generate the META-INF\spring.schemas & spring.handlers. Then on using version 2.2-beta-2, all the required spring.schemas & spring.handlers were being written to the META-INF folder in the final inflated jar.

    Even then i'm getting the same error.

    However, if i run my application using Eclipse, it works fine.

    Interestingly, when i try to open the spring-context-2.5.xsd (springframework/schema/context/spring-context-2.5.xsd) with some XML validation tool (i used XMLSpy), i get errors like:

    'beans:identifiedType' must refer to an existing simple or complex
    Error location: xsd:schema / xsd:element / xsd:complexType /xsd:complexContent / xsd:extension / at base

    Here's the stack trace of my application:
    Exception in thread "main" com.XYZ.core.common.exception.InitializationEx
    ception: Error in initialization of application wmc-core-metrics
    at com.XYZ.core.common.ApplicationBase.run(Applicatio nBase.java:135)
    at com.wellmanage.core.common.ApplicationBase.main(Ap plicationBase.java:174)
    Caused by: org.springframework.beans.factory.parsing.BeanDefi nitionParsingExcept
    ion: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [springframework/schema/context]
    Offending resource: class path resource [spring-context/wmc-core-server-ctx.xml]
    at org.springframework.beans.factory.parsing.FailFast ProblemReporter.err
    or(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:281)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1252)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1245)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:135)
    ......
    ......

    Any pointers will be helpful.

  • #2
    I'm not sure where the bug is (suspect JRE) but you can workaoround it by not using an INDEX.LIST in the jar file. See http://jira.springframework.org/browse/SPR-5705.

    Comment


    • #3
      nkachr: were you ever able to resolve the issue?

      Dave, I manually removed the index.list file and ensured my manifest cp was correctly set, which it is. however, i still encounter the same issue as described by the original poster. Thoughts?

      Comment


      • #4
        Resolved using shade plugin

        I ran into the same issue and was able to resolve it using the maven shade plugin in place of the assembly plugin:
        Code:
        <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.resource.ManifestResourceTransformer">
                    <mainClass>com.prototype.springintegration.AppBootstrapper</mainClass>
                  </transformer>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                    <resource>META-INF/spring.handlers</resource>
                  </transformer>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                    <resource>META-INF/spring.schemas</resource>
                  </transformer>
                </transformers>
              </configuration>
            </execution>
          </executions>
        </plugin>

        Comment

        Working...
        X