Announcement Announcement Module
Collapse
No announcement yet.
unable to locate Spring NamespaceHandler for XML schema namespace 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

    Hello All,

    I created a small Spring MVC/Spring Integration standalone application which I packaged into a a JAR with dependencies. When I try to run the main program, specifying the JAR in the classpath, I get:

    org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/gov/noaa/ngdc/hobo/integration-job-launching.xml]
    Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration]
    Offending resource: class path resource [gov/noaa/ngdc/hobo/integration-job-launching.xml]

    I don't understand this since I see the integration XSD within the JAR at:

    org/springframework/integration/config/xml/spring-integration-2.0.xsd


    Can someone please help me see what the problem is?

    Thanks!

    --john

  • #2
    I don't understand this since I see the integration XSD within the JAR at:

    org/springframework/integration/config/xml/spring-integration-2.0.xsd
    Which jar do you see this file in?

    Whats your jar's structure? Is this some kind of assembly jar where you have exploded all the dependency jars and packaged all the dependencies in one big fat jar?
    For the namespace handlers to work you need to have the spring.schemas and spring.handlers files in the META-INF of the jar file.

    Comment


    • #3
      Thanks for your reply Amol!

      This is a single jar containing all dependencies and produced by maven assembly. The *.xsd files are in packages rooted at the top level of the jar. Do I understand you to say all the *.xsd files should be in packages rooted at META-INF?

      --john

      Comment


      • #4
        Are you saying you unjarred all the Spring classes you need and re-jarred them into your own jar?

        Comment


        • #5
          Thanks Gary.

          The answer is essentially yes - it's my understanding that's what the maven assembly plugin is doing is to create a single jar with all dependencies.

          However, I may be approaching this all wrong though and would be happy for an alternative. I'm not sure of a better way to manage all the transitive dependencies. My original objective was to provide the end user a standalone program that could be run with "java -jar myproject.jar".

          Other ideas?

          --john

          Comment


          • #6
            Well, each spring jar has files in META-INF that map schemas to namespace handlers, and map schemaLocation URIs to physical schema files (at the root, where you have them).

            See META-INF/spring.handlers and META-INF/spring-schemas.

            You would need to merge the individual files from each spring jar from which you are using a schema. That should work.

            Comment


            • #7
              Thanks again Gary, that helps. I think I'll go a different direction though and just use maven or gradle to execute the program (and manage the classpath).

              --john

              Comment

              Working...
              X