Tuesday, May 18, 2010

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]

Writing a Spring Batch project (Spring 2.5.6.SEC01, Spring Batch 2.0.0.RELEASE) and started to make use of the batch namespace to define the steps in the batch job. Everything worked fine testing in Eclipse.

Built the project using maven into an rpm and deployed to a test Linux box as normal and as per all the other batch jobs for this project. The only change to the job had been to switch some elements of the context to the batch namespace.

Tried to run the job and got the following -

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]

After much Googling I found this JIRA that explains a problem with the core Spring project overwriting and ignoring the schemas from the non core Spring projects.

Bob Miers added some help on how he fixed it. My solution is similar.

Create your own spring.handlers and spring.schemas in your own src/main/resources/META-INF directory. Copy into those the contents from both the Spring core jar and the Spring batch jar into these files and bingo - problem solved (for now).

Probably because I'm building an rpm I didn't have to use Bob's solution of using the Maven shade plugin.

No comments: