After running Spring Batch programs in an IDE (Eclipse, IBM RAD), you may notice a NamespaceHandler error when you attempt to run the programs from an exported Runnable JAR.
This error is caused by the archiving process which overwrites the /META-INF/spring.handlers file found in a number of the Spring JARs. Through the IDE, these handlers are additive; each JAR's META-INF resources are added to the classpath. However, the Runnable JAR process will put only a single spring.handlers file on the classpath which is the last one in the Order / Export window in the IDE.
The solution is to prepare a comprehensive spring.handlers file and update the JAR after all of the archiving is completed. This can be done manually, with a script or Ant task, or by packaging your own JAR containing only your finalized /META-INF resources. If you go the JAR route, make sure this JAR is last in the Order and Export window.
No comments:
Post a Comment