wood burning stoves*
The moose likes Tomcat and the fly likes Tomcat 5.5 JRE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5.5 JRE?" Watch "Tomcat 5.5 JRE?" New topic
Author

Tomcat 5.5 JRE?

Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 53
I wrote a web application using jdk 1.6 and tomcat 6.0 at home and it worked fine. Then I wanted to put it online so I found a host site and uploaded my war. I got this:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

This happened when it was trying to load my ServletContextListener. It looks like the host site was running Tomcat 5.5.17.

I then downloaded the java 1.5 jdk and tried to compile my servlet classes with that and then reployed it and I got the same thing. I searched through the tomcat documentation for a while and I couldn't find the JRE it was using to run my classes. What jdk do I need to use to compile my servlet classes for tomcat 5.5.17? Please don't tell me I have to rewrite my classes to be compatible with jdk 1.4. Thanks in advance.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You do not need to re-write your classes to to work with 1.4 if you are using Tomcat 5.5. It requires at least java 1.5.

I'm guessing that something got flubbed up and the class file that was compiled under Java 6 was still up on the server.

Try again, making sure that none of the original class files are still on the server or loaded in Tomcat.


PS: You didn't need to download Java 1.5 to recompile.
javac has a -source switch that allows you to compile down to older versions.

Example:
javac -source 1.5 MyServlet.java


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 53
Thanks a lot. That worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 5.5 JRE?
 
Similar Threads
J2EE and Windows 98?
javax.servlet not found
Unable to compile servlets
problem in compilation of servlet in apache-tomcat
Trouble Installing JForum on VPS