UnsupportedClassVersionError с сервлетом веб-приложения Джерси в Jelastic

Я развертываю свой сервис.war в Jelastic - программу для отображения файлов.war, но я получаю эту ошибку

Exception

javax.servlet.ServletException: Servlet.init() for servlet Jersey Web Application threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:745)

Root cause

java.lang.UnsupportedClassVersionError: sql/rudelman/conn/Conexion : Unsupported major.minor version 52.0 (unable to load class sql.rudelman.conn.Conexion)
    org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3179)
    org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1372)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1860)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:274)
    com.sun.jersey.core.reflection.ReflectionHelper$3.run(ReflectionHelper.java:284)
    com.sun.jersey.core.reflection.ReflectionHelper$3.run(ReflectionHelper.java:279)
    java.security.AccessController.doPrivileged(Native Method)
    com.sun.jersey.spi.scanning.AnnotationScannerListener$AnnotatedClassVisitor.getClassForName(AnnotationScannerListener.java:228)
    com.sun.jersey.spi.scanning.AnnotationScannerListener$AnnotatedClassVisitor.visitEnd(AnnotationScannerListener.java:192)
    jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:697)
    jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
    com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:138)
    com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner$2.f(WebAppResourcesScanner.java:104)
    com.sun.jersey.core.util.Closing.f(Closing.java:71)
    com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:102)
    com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:89)
    com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:89)
    com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:89)

Это мой код

@Path("{cip}")
@GET
@Produces("application/xml")
@WebMethod(operationName="obtenerPersonalCedulas")
public static String obtenerPersonalCedulas(@PathParam("cip")String cip) throws SQLException{
    //boolean opc = false;
    Connection connect = null;
    PreparedStatement pstm = null;
    String nombre = "";
    int genero = 0;
    String apellido = "";
    String apellido2 ="";
    String provincia = "";
    String canton = "";
    String distrito = "";
    String gno = "";
    int cedula = 0;
    String query ="SELECT Cedula ,nombre, Genero, apellido1, apellido2, provincia, canton, distrito FROM CedulasRegion WHERE Cedula ="+cip;

    try{

        connect =conn();
        pstm = connect.prepareStatement(query);
        ResultSet rs = pstm.executeQuery();
        //opc = rs.next();
        while(rs.next()){

            cedula=rs.getInt(1);
            nombre=rs.getString(2);
            genero = rs.getInt(3);
            apellido = rs.getString(4);
            apellido2 = rs.getString(5);
            provincia = rs.getString(6);
            canton = rs.getString(7);
            distrito = rs.getString(8);

            if(genero == 1)
            {
                gno = Integer.toString(genero);
                gno = "Masculino";
            }
            else
            {
                    gno = "Femenino";
            }
        }

    }catch(SQLException se)
    {

        System.out.println(se.getMessage());
    }
    String result = "@Produces(\"application/xml\")Output: \n\n<datos>"+"<cedula>"+cedula+"</cedula>"+"<nombre>"+nombre+"</nombre>"+"<genero>"+gno+"</genero>"
            +"<apellido>"+apellido+"</apellido>"+"<apellidoSegundo>"+apellido2+"</apellidoSegundo>"+"<provincia>"+provincia+"</provincia>"
            +"<canton>"+canton+"</canton>"+"<distrito>"+distrito+"</distrito>"+"</datos>";
    return "<conexion>"+"<cip>"+cip+"</cip>"+"<conexionOutput>"+result+"</conexionOutput></conexion>";

}

}

Это мой POM.XML

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ConnectionSql</groupId>
<artifactId>ConnectionSql</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.19</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.19</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.19</version>
    </dependency>
</dependencies>

0 ответов

Другие вопросы по тегам