使用休眠框架在mariaDB上执行查询,系统返回以下消息:


  2019年4月4日4:43:48 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
  INFORMAZIONI:正在初始化c3p0池... com.mchange.v2.c3p0.PoolBackedDataSource@3a29d5cf [connectionPoolDataSource->
  2019年4月4日4:47:58 com.mchange.v2.resourcepool.BasicResourcePool
  ...
  ...
  ...
  AVVERTENZA:com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7a0c574a-尝试获取失败!!!清算未完成的收购。在尝试获取所需的新资源时,我们未能成功超过允许的最大尝试获取次数(30)。上次获取尝试异常:
  java.sql.SQLNonTransientConnectionException:无法创建与数据库服务器的连接。尝试重新连接3次。放弃。
      在com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
      在com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      在com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
      在com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
  `


没有更多的日志可以理解该问题,并且总体而言,似乎突然出现了此问题...某些日食更新是否可能更改了代码的先前“良好状态”?有什么方法可以执行深度调试?

在休眠属性文件下面:

hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.connection.driver_class=com.mysql.cj.jdbc.Driver
hibernate.connection.url=jdbc:mysql://*******:****/anagraphic?autoReconnect=true&characterEncoding=UTF-8
hibernate.connection.username=*****
hibernate.connection.password=*****
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=false
hibernate.use_sql_comments=true
hibernate.format_sql=true
hibernate.generate_statistics=false
hibernate.current_session_context_class=thread
hibernate.jdbc.lob.non_contextual_creation=true

hibernate.connection.autoReconnect=true
hibernate.connection.autoReconnectForPools= true
hibernate.minIdle=5
hibernate.connection.useUnicode=true
hibernate.connection.characterEncoding=UTF-8
hibernate.connection.charSet=UTF-8
hibernate.bytecode.provider = cglib
hibernate.jdbc.use_streams_for_binary =true
hibernate.cglib.use_reflection_optimizer =true
hibernate.jdbc.fetch_size=20
hibernate.jdbc.batch_size=20

hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
hibernate.cache.user_query_cache=true
hibernate.cache.user_second_level_cache=true

hibernate.c3p0.max_size=15
hibernate.c3p0.min_size=3
hibernate.c3p0.timeout=180
hibernate.c3p0.max_statements=0
hibernate.c3p0.idle_test_period=300
hibernate.c3p0.acquire_increment=3

最佳答案

解决了!!
似乎该问题是在占用夏时制之后引起的。
CEST时间是问题所在;解决方案是在“ maria db”的连接字符串中添加“ serverTimeZone = UTC” ...下面的示例:

jdbc:mysql:// *******:**** / anagraphic?autoReconnect = true&characterEncoding = UTF-8&serverTimezone = UTC

10-04 18:55