当前位置:   article > 正文

问题: java.sql.SQLException:The server time zone value ‘�й���׼ʱ��‘_caused by: java.sql.sqlexception: the server time

caused by: java.sql.sqlexception: the server time zone value ' й

java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.

今天在启动一个导入的项目时,出现了一个之前完全没有预料到的问题,最开始不知道是什么原因,从数据库配置上并没有发现问题,就查找了下资料,说是数据库连接配置时,没有配置时区参数serverTimeZone,或是时区参数错误,修改后启动正确

出现上述问题后,一般为数据库连接的url地址配置中,没有配置时区serverTimezone=UTC或配置错误,修改下即可

如: jdbc:mysql://{ip}:{port}/{database_name}?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8

如下是日常报错信息(部分):

  1. 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 zone value if you want to utilize time zone support.
  2. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
  3. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
  4. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
  5. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
  6. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
  7. at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
  8. at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
  9. at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
  10. at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
  11. at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
  12. at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
  13. at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353)
  14. at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
  15. at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
  16. at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562)
  17. at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
  18. at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
  19. at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158)
  20. at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116)
  21. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
  22. at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80)
  23. at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)
  24. at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336)
  25. at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.prepareStatement(MybatisSimpleExecutor.java:91)
  26. at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:66)
  27. at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
  28. at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
  29. at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(MybatisCachingExecutor.java:163)
  30. at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(MybatisCachingExecutor.java:90)
  31. at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
  32. at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
  33. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  34. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  35. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  36. at java.lang.reflect.Method.invoke(Method.java:498)
  37. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
  38. at com.sun.proxy.$Proxy69.selectList(Unknown Source)
  39. at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223)
  40. at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:177)
  41. at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:78)
  42. at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:96)
  43. at com.sun.proxy.$Proxy87.selectList(Unknown Source)
  44. at com.lingxu.cjt.v2.service.TableCheckLostener.onApplicationEvent(TableCheckLostener.java:27)
  45. at com.lingxu.cjt.v2.service.TableCheckLostener.onApplicationEvent(TableCheckLostener.java:16)
  46. at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
  47. at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
  48. at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
  49. at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
  50. at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
  51. at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
  52. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
  53. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
  54. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
  55. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
  56. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  57. at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
  58. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
  59. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
  60. at com.lingxu.cjt.Application.main(Application.java:15)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/505767
推荐阅读
相关标签
  

闽ICP备14008679号