Search code examples
javaweb-servicesjettyjax-wscom.sun.net.httpserver

Class not found JettyHttpServerProvider -> Unsupported major.minor version 52.0


By setting

 System.setProperty(.sun.net.httpserver.HttpServerProvider",
          "org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider");

The org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider class is not found.

sun.misc.ServiceConfigurationError: java.lang.ClassNotFoundException: org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider

I have included libs: Jetty 9, jaxws-ri-2.2.10, Jaxb-2.2.7

I already checked out:
Metro + Jetty + OSGi = pain

but the codehaus stuff is afaik moved to eclipse...

Where is the org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider ?

Edit:

Ok i found out that it was renamed to org.eclipse.jetty.http.spi.JettyHttpServerProvider

But now i am getting:

java.lang.UnsupportedClassVersionError: org/eclipse/jetty/http/spi/JettyHttpServerProvider : Unsupported major.minor version 52.0

Solved: By using Jetty 9.0.6 it is compatible with Java 7


Solution

  • As you can see from the Java Class File format byte offsets 6 and 7 are used to store the class file version. The table here will help

    Version 52 is used to indicate that the class file format is Java 8. My guess is that you're using a library with a Java 8 requirement (or just one that was built using Java 8 and not targeting a previous class file format) and running on Java 7.

    Jetty 9 is supposed to be Java 1.7 based which means you're either using something newer or you're using somebody's customised version that requires Java 8.