• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat 5.5 JRE?

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Benjamin Hundley
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot. That worked.
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic