tags:

views:

270

answers:

2

Hello i install jetty 6.1.8 on windows for development,

I configure it in eclipse to run with jdk 1.5, and my project is configured to build using the same jdk.

my problem is my project can't be runned using jetty server. it complained the below error message. Please note I can start jetty without error when there is no project added. If I configure jetty to use jdk 1.6, then i can add my project and everything works fine. so does it mean that jetty 6.1.8 doesn't support jdk 1.5?

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)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    at org.mortbay.util.Loader.loadClass(Loader.java:91)
    at org.mortbay.util.Loader.loadClass(Loader.java:71)
    at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:233)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.deployer.ContextDeployer.deploy(ContextDeployer.java:268)
    at org.mortbay.jetty.deployer.ContextDeployer.access$000(ContextDeployer.java:67)
    at org.mortbay.jetty.deployer.ContextDeployer$ScannerListener.fileAdded(ContextDeployer.java:89)
    at org.mortbay.util.Scanner.reportAddition(Scanner.java:417)
    at org.mortbay.util.Scanner.reportDifferences(Scanner.java:331)
    at org.mortbay.util.Scanner.scan(Scanner.java:286)
    at org.mortbay.util.Scanner$1.run(Scanner.java:246)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
A: 

Yes it does: http://www.eclipse.org/jetty/about.php (bottom of the page)

stimms
A: 

According to this page, Jetty 6.1.x supported Java 1.6. I suspect that you have downloaded Jetty JAR files that were compiled using the Java 1.6 compilers. Get the 1.5 JARs and all should be well.

EDIT: I just downloaded the 6.1.8 ZIP file from here, and the JAR files therein were compiled for Java 1.4 or later (code version #48). You must have picked up a dodgy JAR file from somewhere!

Stephen C
Actually it's my bad. I didn't change the compiler setting in eclipse to build with the 1.5 jdk, that's why when i add the project to jetty, it complained about the different jdk version.
dara