0

I am using jre 1.5 tomcat server. In my application I am calling a web service. When I call the web service I got the following error.

java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

So I found that the problem is with jax-ws jar file.

I am using following jar file in my application build path.

jaxws-api-2.0.jar

I just added only this jar file. I suspect this jar is not compiled under jre 1.5.

Please help me how to get rid of this issue. Or point me to a jar file which can work under jre 1.5.

Ivaylo Slavov
  • 8,839
  • 12
  • 65
  • 108
Rookie007
  • 1,229
  • 2
  • 18
  • 50
  • 1
    Java 1.5 is rather old in the meantime, any chance to upgrade? – Henry May 31 '14 at 08:06
  • @Henry No chance to upgrade .. Any alternative. – Rookie007 May 31 '14 at 08:10
  • @RomanC I tried that .. My Compiler and everything is in JDK 1.5 only.. JRE1.5 only.. And I can fiund least version for `jax-ws` is `jaxws-api-2.0.jar` which is not spporting .. – Rookie007 May 31 '14 at 08:12
  • Maybe this helps: http://stackoverflow.com/questions/12090624/jax-ws-ri-on-java-5 – Henry May 31 '14 at 08:16
  • 1
    You would really *really* be better off upgrading - it's worth putting significant effort into that. JDK 1.5 is over 10 years old now... how confident are you that there aren't security problems that haven't been patched on your machine? – Jon Skeet May 31 '14 at 08:16
  • 2
    *"No chance to upgrade"* - why? Seriously, if you are running a Tomcat server, upgrading your JVM is always a possibility. The only plausible reason not to is that your management is clinically risk averse ... and ignorant of the risks of running old / unpatched software. – Stephen C May 31 '14 at 08:28

1 Answers1

2

Firstly, your best option is upgrade to Java 7 (or better still 8), and consider upgrading to a more recent release of Tomcat.

The Java 5 platform is truly ancient, and (free) security patches were discontinued a number of years ago. So unless you are paying for Oracle Java maintenance, your JVM is likely to have a number of unpatched security flaws in it.

There is really no solid reason to not upgrade if you are running Tomcat, especially since you are apparently building / deploying new webapps to it.


If you can't, then your best bet is to download the source code for the JAXWS 2.0 API and attempt to compile it with a Java 5 compiler. However:

  • I've not been able to track down the JAXWS 2.0 API source code. The closest I could find was 2.2.
  • There is a chance that the JAXWS 2.x API source code won't compile under Java 5.

Related Question: JAX-WS RI on Java 5.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216