Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UnsupportedClassVersionError while startup.

 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

When I try to startup tomcat 6.0.10 using 'startup' fron a Window platform, I am not able to. So when I tried using the 'catalina debug' startup option I get a UnsupportedClassVersionError. Since I was on JDK 1.6 I guessed it could be a compatibility issue between versions. I got JDK 1.5.0_11.

My issue is like I still get the same error. Checking the documentation I found that tomcat 6.0 works with JDK 1.5 Any ideas on how to resolve this?

Thanks,
Rajkamal.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For which class is the UnsupportedClassVersionError reported? The stack trace in the log files should say so.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been thrown in the ClassLoader. I also have my CATALINA_HOME and JAVA_HOME pointing to the correct folders.

This is the relevant stack trace part....

============================================================================
run org.apache.catalina.startup.Bootstrap start
>
VM Started:
Exception occurred: java.lang.UnsupportedClassVersionError (uncaught) thread="ma
in", java.lang.ClassLoader.defineClass(), line=732, bci=217

main[1] cont
java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap (U
nsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass(ClassLoader.java:732)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:13
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:320)
at java.net.URLClassLoader.access$400(URLClassLoader.java:93)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:239)
at java.lang.ClassLoader.loadClass(ClassLoader.java:516)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:460)
at java.lang.ClassLoader.loadClass(ClassLoader.java:448)
> Exception in thread "main"

The application exited
============================================================================
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class version 49.0 is the one used by Java 5, so if the JVM complains about that, it must be 1.4 at the most. How are you starting Tomcat, and how do you determine which JRE it uses?
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ulf,

I downloaded JRE 1.4.2_14. Uninstalled JRE 1.5 and got the older version installed. Still I get the same error report. When I do a java -version this is what I get :-
===
java version "1.4.2_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_14-b05)
Java HotSpot(TM) Client VM (build 1.4.2_14-b05, mixed mode)
===
Shouldn't it be running on the same (currently installed) JRE? Do you think I sould be looking for JRE 1.4.0 or something?

And thanks a ton!!!
Rajkamal.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm starting tomcat with 'startup' and if it fails I go for the 'catalina debug' so that I get the error/exception report.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since I was on JDK 1.6 I guessed it could be a compatibility issue between versions. I got JDK 1.5.0_11.


Personally I compile using JDK 1.6 but with target=1.5 and source=1.5 in order to avoid that unsupported error with Tomcat 5.5.9

Bill
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I'm not trying to deploy any of my applications on Tomcat. All I'm doing is trying to startup the server and thats when I get this error. As far as tomcat installation is concerned I have a binary version downloaded. What I feel is maybe I'm leaving out something?

Could somebody help me on that?

Thanks,
Rajkamal.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you think I sould be looking for JRE 1.4.0 or something?


No. It was already running on a 1.4 JVM; that's why you got that error. A 1.5 or later JVM wouldn't have this problem.

It's not unheard of to have multiple JREs installed, sometimes without even being aware of it. Alter the startup script so that it definitely uses a 1.5 JRE to run, and see what happens.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,

On your advice, I checked with the JRE installed on my machine. There were multiple JREs installed on my machine. There was a 1.4 and a 5.0. That must've been the cause, I feel.

I uninstalled the JRE on my box and got JRE 5.0 alone. Then when I tried to get tomcat started it went through well.

The issue has been resolved and thanks a lot for your guidance.

Rajkamal.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic