Search code examples
javamavenweblogicear

getting classNotFound Exception when deploying ear on weblogic


When I deploy my ear file on weblogic administrator console, I get the following error -

javax.servlet.ServletException: [HTTP:101249][ServletContext@47518104[app:CorporateActionDatabaseEAR-0 module:/CorporateActionDatabaseWAR path:/CorporateActionDatabaseWAR spec-version:null]]: Servlet class org.glassfish.jersey.servlet.ServletContainer for servlet Jersey Web Application could not be loaded because the requested class was not found in the classpath . java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : unsupported classversion 51.0.

Any idea why this is happening? I know it has something to do with adding jersey-container-servlet-core jar but which module do I add it in? my war module or my jar module or my ear module? Note that it is a maven web project that I have obtained an ear file from.

My java version is 1.7 and I have already tried adding jersey-core-1.17.1 and jersey-servlet-1.17.1 to the build path of the war module but I still seem to be getting the same error.

Much appreciated!


Solution

  • Which version of JREare you using for weblogic?

    The "unsupported classversion X.Y." error occurs when JVM tries to load a class file that has been compiled with a higher version of java. In this case, 51.0 indicates that he class file has been compiled with java 1.7 and may be your version of java is < 1.7. In that case, I see two options to solve the issue

    1. Use java 1.7 or above to run the weblogic.
    2. Or get a jersey-container-servlet-core jar (and dependent jars if any) that is compatible with your JRE.