1

am developing a simple web app using jsps and servlets for tomcat 5.5.
Currently using the Eclipse Helios and Dynamic Web Application Project.

For some reason it is a nightmare. We spent 4 hours today trying to deploy a servlet to tomcat. We kept getting errors like

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

we played around with everything trying to set the build compatibility to what tomcat had but couldn't make the stupid thing work. (Yes it is possible we're incompetent. any suggestions on what we can try looking at are apprecieated)

My friend recalls from long time ago that he used this plugin
eclipsetotale_tomcatPlugin in order to create a "tomcat project". My question is, does sysdeo tomcat plugin add any features that aren't already available in helios?

thanks

Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
w--
  • 6,427
  • 12
  • 54
  • 92

4 Answers4

1

Not sure about sysdeo, but your error seems similar to bug 116713:

If your default JRE is set to 1.4.2 and you have a Web project targetting Tomcat 5.5 (dynamic Web module version 2.4 and Java 5.0), when you tried to run a main program, you'll get the error (you mention).

What is your default JRE set for your project?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • not sure if this is the same thing, we tried setting the build compatibility to 1.5 and it still didn't work. also this is a web project, so.... what is the "main" program? (java newb... so not aware of the obvious) – w-- Jan 08 '11 at 07:40
  • @w-- Check your default JRE, like in http://stackoverflow.com/questions/1016286/org-apache-xerces-jaxp-saxparserfactoryimpl-not-found-when-importing-gears-api-in/1020779#1020779 for instance. – VonC Jan 08 '11 at 07:47
  • thanks for the tip. I think we also tried this, and even pointed the JRE to the one tomcat was using... =| – w-- Jan 08 '11 at 08:01
  • 1
    @w-- but somehow, at the execution, the JRE used seems incorrect... Do you have several JDKs installed? or a JAVA_HOME environment variable that might have an effect? A bit like in http://stackoverflow.com/questions/1529059/tomcat-6-the-requested-resource-is-not-available or http://www.coderanch.com/t/292805/JSP/java/Bad-version-number-class-file, but also http://www.mkyong.com/java/javalangunsupportedclassversionerror-bad-version-number-in-class-file/ – VonC Jan 08 '11 at 08:06
1

This scenario happens when the JVM running the code is older than the one the compiler generated code for.

Have you considered simply running Tomcat under Java 6? If that is not an option, please edit your question to include this and any other restrictions on this project.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
1

We used to get that error often when we had Java version issues. Eclipse environment and Windows environment (java_home and path variables typically) are easy to overlook. Also, you can use javap -v Foo in same directory as Foo.class to find out its version.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
tony
  • 11
  • 1
0

Just use the Eclipse IDE for Java EE Developers, 206 MB edition of Eclipse. It has Tomcat and other webserver support built-in by default. Works like a charm!

Sysdeo is an old, as far as I know obsolete, plugin.

rodion
  • 14,729
  • 3
  • 53
  • 55