我在Apache Tomcat / 7.0.52(Ubuntu)JVM上使用 mysql-connector-java-6.0.3.jar 部署我的战争时出现此问题:1.7.0_79-b14编译 JDK 1.7
import tkinter as tk
...
root = tk.Tk()
...
on_image = tk.PhotoImage(...)
off_image = tk.PhotoImage(...)
...
rbvar = tk.IntVar(value=1)
rb1 = tk.Radiobutton(root, variable=rbvar, value=0, bd=0,
text="One", compound="left", indicatoron=False,
image=off_image, selectimage=on_image)
rb2 = tk.Radiobutton(root, variable=rbvar, value=1, bd=0,
text="Two", compound="left", indicatoron=False,
image=off_image, selectimage=on_image)
...
当我使用 1.8
编译时java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0 (unable to load class com.mysql.jdbc.Driver)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:191)
com.tdk.callbacks.CallBacksListener.doGet(CallBacksListener.java:45)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
这个 1.6 :
java.lang.UnsupportedClassVersionError: com/tdk/callbacks/CallBacksListener : Unsupported major.minor version 52.0 (unable to load class com.tdk.callbacks.CallBacksListener)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:9)
问题不在于编译。问题是你尝试使用java 7 运行你的Tomcat和部署的应用程序。作为你的mysql驱动程序,并且你的应用程序可能是用java 8编译的,你必须使用java 8来运行Tomcat < / p>