为了账号安全,请及时绑定邮箱和手机立即绑定

CDSpace中发送post接口,报java.sql.SQLException: Unknown system variable 'tx_isolation'

日志如下:



Wed Apr 22 11:45:03 CST 2020


HTTP/1.1 500 Internal Server Error

<html><head><title>Apache Tomcat/7.0.73 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org.hibernate.exception.GenericJDBCException: Cannot open connection</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org.hibernate.exception.GenericJDBCException: Cannot open connection</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection

org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)

org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:202)

com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

com.imooc.service.StudentService.doPost(StudentService.java:69)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

</pre></p><p><b>root cause</b> <pre>org.hibernate.exception.GenericJDBCException: Cannot open connection

org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)

org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)

org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)

org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)

org.hibernate.loader.Loader.doQuery(Loader.java:673)

org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)

org.hibernate.loader.Loader.loadEntity(Loader.java:1860)

org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)

org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)

org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3049)

org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:399)

org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)

org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)

org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)

org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)

org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)

org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)

org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)

org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)

com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

com.imooc.service.StudentService.doPost(StudentService.java:69)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

</pre></p><p><b>root cause</b> <pre>java.sql.SQLException: Unknown system variable 'tx_isolation'

com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)

com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)

com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)

com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)

com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619)

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2569)

com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1521)

com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3173)

org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:115)

org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)

org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)

org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)

org.hibernate.loader.Loader.doQuery(Loader.java:673)

org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)

org.hibernate.loader.Loader.loadEntity(Loader.java:1860)

org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)

org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)

org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3049)

org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:399)

org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)

org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)

org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)

org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)

org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)

org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)

org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)

org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)

com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

com.imooc.service.StudentService.doPost(StudentService.java:69)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.73 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.73</h3></body></html>


正在回答

3 回答

补充:我还修改了这个
http://img1.sycdn.imooc.com//5e9feaa70001d77c13800508.jpg

0 回复 有任何疑惑可以回复我~

我的jdk是"1.8.0_144"
数据库是mysql-8.0.17
并替换了mysql-connector-java-8.0.11.jar

http://img1.sycdn.imooc.com//5e9fe74e0001f22008480258.jpg


但还是报错:java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0 (unable to load class com.mysql.jdbc.Driver)
具体如下:

不知道该怎么办了

Wed Apr 22 14:43:11 CST 2020


HTTP/1.1 500 Internal Server Error

<html><head><title>Apache Tomcat/7.0.73 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Servlet execution threw an exception</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Servlet execution threw an exception</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet execution threw an exception

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

</pre></p><p><b>root cause</b> <pre>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.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3200)

org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)

org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)

org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)

java.lang.Class.forName0(Native Method)

java.lang.Class.forName(Class.java:195)

org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:57)

org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)

org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)

org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)

org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)

org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)

org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)

javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

com.imooc.DAO.StudentDAO.find(StudentDAO.java:66)

com.imooc.service.StudentService.doGet(StudentService.java:149)

javax.servlet.http.HttpServlet.service(HttpServlet.java:624)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.73 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.73</h3></body></html>


0 回复 有任何疑惑可以回复我~

查了下,是mysql版本太高,需要升级mysql-connector-java。不知道具体怎么做,愁人

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

CDSpace中发送post接口,报java.sql.SQLException: Unknown system variable 'tx_isolation'

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信