Friday, November 16, 2007

jar hell

Those who work with multiple open source stack need to be pitied. With your different open source stacks coming bundled with different versions of same jar files (e.g. xerces.jar which is a common occurrence in so many stacks), unexpected problems can crop up which hard to debug by just looking at the exception trace.
I had one such problem and it was very difficult for me to find the solution(solution method I am referring to is of-course googling) and hence the post for others who get stuck on this one.
If you see following exceptions:
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
and
SAXNotRecognizedException: Feature >>'http://apache.org/xml/features/xinclude' is not recognized.

Most probably you have multiple incompatible versions of xerces.jar in your classpath.

My particular problem was xerces-2.6.2.jar which was there as part of hibernate 3.2 dependency was conflicting with newer version required by jboss which is 2.7.1 (xercesImpl.jar) and is present in JBOSS_HOME/lib/endorsed dir.
Removing xerces-2.6.2 from classpath solved this probelm.

Hope this helps some other unfortunate programmer who gets stuck!

No comments: