Hibernate卡住,然后报错java.sql.SQLException: Unknown system variable 'language'异常

启动应用的时候会卡在:

08:22:58,221 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator].

08:22:58,226 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.secure.spi.JaccIntegrator].

08:22:58,229 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.cache.internal.CollectionCacheInvalidator].

08:22:58,320  INFO Version:37 - HHH000412: Hibernate Core {5.0.7.Final}

08:22:58,322  INFO Environment:213 - HHH000206: hibernate.properties not found

08:22:58,324  INFO Environment:317 - HHH000021: Bytecode provider name : javassist

08:22:58,353 DEBUG LocalXmlResourceResolver:57 - Interpreting public/system identifier : [-//Hibernate/Hibernate Configuration DTD 3.0//EN] - [http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd]

08:22:58,353 DEBUG LocalXmlResourceResolver:85 - Recognized hibernate-configuration identifier; attempting to resolve on classpath under org/hibernate/

08:22:58,357 DEBUG JaxbCfgProcessor:116 - cfg.xml document did not define namespaces; wrapping in custom event reader to introduce namespace information

08:22:58,511 DEBUG Configuration:722 - Building session factory using internal StandardServiceRegistryBuilder

08:22:58,519 DEBUG ServiceBinding:68 - Overriding existing service binding [org.hibernate.secure.spi.JaccService]

08:22:58,519 DEBUG Configuration:653 - Building session factory using provided StandardServiceRegistry

08:22:58,538 DEBUG RegionFactoryInitiator:88 - Cache region factory : org.hibernate.cache.internal.NoCachingRegionFactory

08:22:58,546  INFO Version:66 - HCANN000001: Hibernate Commons Annotations {5.0.1.Final}

08:22:58,632  INFO ConnectionProviderInitiator:187 - HHH000130: Instantiating explicit connection provider: org.hibernate.connection.C3P0ConnectionProvider

08:22:58,637  INFO C3P0ConnectionProvider:117 - HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///exam

08:22:58,638  INFO C3P0ConnectionProvider:118 - HHH10001001: Connection properties: {user=root, password=****, autocommit=false}

08:22:58,638  INFO C3P0ConnectionProvider:121 - HHH10001003: Autocommit mode: false

08:22:58,934  INFO C3P0ConnectionProvider:201 - HHH10001007: JDBC isolation level: <unknown>

随后抛出如下异常:

08:23:29,343  WARN BasicResourcePool:1851 - com[email protected]12bfebe -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: Unknown system variable ‘language‘

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)

at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)

at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3833)

at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3283)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2297)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:635)

08:23:29,346  WARN BasicResourcePool:1851 - com[email protected]125ba1c -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

java.sql.SQLException: Unknown system variable ‘language‘

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)

at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)

at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3833)

at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3283)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2297)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)

at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)

at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:635)

08:23:29,343  WARN BasicResourcePool:1851 - com[email protected]1d7070d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:

解决办法:此问题为MySql驱动版本与mysql版本不兼容导致,换一个较低版本的驱动即可解决。例如:换成mysql-connector-java-5.1.6.jar

Hibernate卡住,然后报错java.sql.SQLException: Unknown system variable 'language'异常

时间: 2024-10-26 13:28:00

Hibernate卡住,然后报错java.sql.SQLException: Unknown system variable 'language'异常的相关文章

JDBC报错 消息 Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

今天用JDBCTemplate时,发现启动服务器之后报错: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'. 网上说是因为MySQL版本过高的问题,我的MySQL版本是8.0,里面已经没有tx_isolation,变成了transaction_isolation,用了以下几种解决方法: (1)更改MySQL  无效,仍然

解决问题:java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

是因为MySQL版本高但驱动jar包的版本太低, 因此将mysql-connector-java升级到最新版本就解决了问题: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.17</version></dependency> 但紧接着又发现报错: 在数据库连接配置文件

java.sql.SQLException: Unknown system variable &#39;query_cache_size&#39;

Jar包版本不对: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.40</version> </dependency> 换个版本就好了: <dependency> <groupId>mysql</groupId> <arti

java连接sqlserver2008报错 java.sql.SQLException: 对象名 &#39;表名&#39; 无效.

注意:c3p0的数据库配置方式为: <named-config name="sqlsvr"> <property name="driverClass">net.sourceforge.jtds.jdbc.Driver</property> <property name="jdbcUrl">jdbc:jtds:sqlserver://localhost:1433/WaterNet_DaFeng<

java.sql.SQLException: Unknown column &#39;user0_.user_name&#39; in &#39;field list&#39; 报错问题

报错信息: java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list'Query is: select user0_.id as id1_0_, user0_.user_name as user_nam2_0_, user0_.password as password3_0_ from user user0_java thread: http-nio-8881-exec-1 Hibernate报错:说表里没有u

hibernate 出现Caused by: java.sql.SQLException: Column &#39;id&#39; not found.异常

用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column 'id' not found 异常,检查数据库表及映射都有id且已经正确映射,google后发现原因为: Your query doesn't return a field named id即查询sql中没有查询出主键id列,但返回结果集中用到,故出现异常特此记录. 详细解答见下: http://stackoverflow.com/questions/34164411/cau

连接mysql报错java.sql.SQLException: The server time zone value &#39;?й???????&#39; is unrecognized...解决方法

报错内容: java.sql.SQLException: The server time zone value '?й???????' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time

java.sql.SQLException: Unknown type &#39;246 in column 0 of 1 in binary-encoded result set的解决办法

最近在大学毕设项目基础上新增一些功能,基于Struts2开源框架,数据库采用的是MySQL.写完后台的新功能代码,单元测试也顺利通过,去整合前台,但是当使用JSP页面操作的时候,没想到报异常了.截图如下: java.sql.SQLException: Unknown type '246 in column 2 of 4 in binary-encoded result set. 纳闷了,为什么能够通过JUnit呢? 几经查找,都说是MySQL的bug,更换了MySQL新版本的驱动包,比如mysq

java.sql.SQLException: Column &#39;class&#39; not found.异常没有找到列

1 /**处理当个对象的 ,rs中要么有一条,要么一条没有. 2 * @param <T> 3 */ 4 public class BeanHandler<T> implements ResultSetHandler<T> { 5 private Class<T> type; 6 public BeanHandler(Class<T> type){ 7 this.type = type; 8 } 9 /**将rs->T t 10 */ 11