Wednesday, June 4, 2014

jar versions.

Ran into the dreaded "UnsupportedClassVersionError: Bad version number in .class" exception today when building a cxf based webservice client on java 1.5. Went searching through the jars to find out the jar that had classes for 1.6 and above. Since there were a number of jar files, I decided to write a shell script.

find_version_of_jars.ksh

Strangely, all the jars had a major version of <=49 (java 1.5). 

Tried to figure out which class was being loaded using the "java verbose:class" option, but this just gives you the classes after they have been loaded. The UnsupportedClassVersionError really needs to print out the class name (and file) to make things easier..

I was able to replace cxf with java ws reference implementation. I used their 2.2.6_4 version which said it required java 1.5, but there were two jars in there which had been targetted to 1.6. Using their 2.2.5 version seemed to work (atleast it ran the wsimport without issues..).. 


No comments:

Post a Comment