servlet project exception on server
my project work on eclipse good but when i make war and run on server i give this exception:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
java.lang.Thread.run(Thread.java:595)
root cause
java.lang.UnsupportedClassVersionError: Bad version number in .class file
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:621)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:873)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1326)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
java.security.AccessController.doPrivileged(Native Method)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
java.lang.Thread.run(Thread.java:595)
note The full stack trace of the root cause is available in the A开发者_如何学Pythonpache Tomcat/5.5.23 logs.
You've compiled classes with a version of the JDK that your server does not support.
Either see if you can get matching JDKs for both your dev. environment and your server, or try to use the -target
option of javac
when you build to target your server's Java version.
JVM can only run a class file that is compiled using the same version or earlier version of Java Compiler .
UnsupportedClassVersionError
will happen if you use a lower version of JVM to run a class file that is compiled using an higher version of Java Compiler.
So make sure that your tomcat is using a higher JDK version than the version of JDK that is used to compile the .class
files in your war.
You can neither upgrade the JDK of the tomcat server to the latest version ,or use the same version of JDK that the tomcat is used to compile your source and build the war
精彩评论