I am trying to start very simple Java webapp on Jetty (v9.0) webserver.
Using maven I built and created the war and as can be see in the manifest file, I used Java 1.6u43 for compilation on OS X
Contents of META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: irraju
Build-Jdk: 1.6.0_43
I am running Jetty on Ubuntu and as can be seen, I have slightly higher version of the java 1.6.0_45. If java is backward compatible, my java application should run on jetty but it is failing with unsupported minor version
root# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
root# java -DDEBUG -jar start.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/jetty/start/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.eclipse.jetty.start.Main. Program will exit.
Other people on the internet are facing this issue when they are trying to run Java 1.7 compiled applications on 1.6* JVMs. I am unable to figure out why this is happening in my case where both the ENVs are 1.6* and deployment ENV has slightly higher version of JVM.
If I deploy the application on Tomcat that is using java 1.6.0_45, it doesn't complain though and works fine. Am I missing something very trivial here?
Jetty 9 requires to be ran with Java 7, according to this list of Jetty versions.
You can try to compile Jetty 9 yourself using Java 6, but that will most likely not work (otherwise, the Jetty devs might've done that themselves as well).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With