The first resolution Hibernate error article, hope to help the same have this wrong children's shoes ~
Error org.hibernate.service.spi.ServiceException:Unable to create requested service [ Org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
caused By:java.sql.SQLException:The server time zone value ' öð¹ú±êx¼ê±¼ä ' are unrecognized or represents more than one TI Me zone. You are must configure either the server or JDBC driver (via the Servertimezone configuration) to use a more specifc Time zone value if your want to utilize time zone support.
Through the last sentence, we know that JDBC 8 versions must configure the time zone
So you want to follow the location of the MySQL server address? servertimezone=utc
The project is configured as follows
Hibernate.cfg.xml
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<! DOCTYPE hibernate-configuration Public
"-//hibernate/hibernate Configuration dtd//en"
"Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" >
<session-factory>
<property name= "Connection.url" >jdbc:mysql://localhost:3306/hibernate?serverTimezone=UTC</property>
<property name= "Connection.driver_class" >com.mysql.cj.jdbc.Driver</property>
<property name= "Connection.username" >root</property>
<property name= "Connection.password" >12345678</property>
<!--JDBC Connection pool (use the built-in)-->
<property name= "Connection.pool_size" >4</property>
<!--SQL dialect-->
<property name= "dialect" >org.hibernate.dialect.MySQLDialect</property>
<!--Enable Hibernate ' s automatic session Management-->
<property name= "Current_session_context_class" >thread</property>
<!--Disable the Second-level cache-->
<!--<property name= "Cache.provider_class" >org.hibernate.cache.internal.nocacheprovider</property >-->
<!--display SQL statements in a well-formed manner-->
<property name= "Format_sql" >true</property>
<!--Echo all executed SQL to stdout-->
<property name= "Show_sql" >true</property>
<!--Drop and re-create the database schema on startup-->
<property name= "Hbm2ddl.auto" >update</property>
</session-factory>
Full error prompt is
Org.hibernate.service.spi.ServiceException:Unable to create requested service [ Org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.createService (Abstractserviceregistryimpl.java : 271)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService ( abstractserviceregistryimpl.java:233)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (abstractserviceregistryimpl.java:210)
At Org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure (jdbcservicesimpl.java:51)
At Org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService ( standardserviceregistryimpl.java:94)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService ( abstractserviceregistryimpl.java:242)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (abstractserviceregistryimpl.java:210)
At Org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes (metadatabuildingprocess.java:352)
At Org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (metadatabuildingprocess.java:111)
At Org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build (metadatabuildingprocess.java:83)
At Org.hibernate.boot.internal.MetadataBuilderImpl.build (metadatabuilderimpl.java:418)
At Org.hibernate.boot.internal.MetadataBuilderImpl.build (metadatabuilderimpl.java:87)
At Org.hibernate.boot.MetadataSources.buildMetadata (metadatasources.java:179)
At Com.stonetech.controllerTest.StudentsEntityTest.setUp (studentsentitytest.java:28)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:498)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:50)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:47)
At Org.junit.internal.runners.statements.RunBefores.evaluate (runbefores.java:24)
At Org.junit.internal.runners.statements.RunAfters.evaluate (runafters.java:27)
At Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:325)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:290)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:58)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268)
At Org.junit.runners.ParentRunner.run (parentrunner.java:363)
At Org.junit.runner.JUnitCore.run (junitcore.java:137)
At Com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs (junit4ideatestrunner.java:68)
At Com.intellij.rt.execution.junit.ideatestrunner$repeater.startrunnerwithargs (IdeaTestRunner.java:47)
At Com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart (junitstarter.java:242)
At Com.intellij.rt.execution.junit.JUnitStarter.main (junitstarter.java:70)
caused By:org.hibernate.exception.JDBCConnectionException:Error calling Driver#connect
At Org.hibernate.engine.jdbc.connections.internal.basicconnectioncreator$1$1.convert ( basicconnectioncreator.java:105)
At Org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException ( basicconnectioncreator.java:123)
At Org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection ( DRIVERCONNECTIONCREATOR.JAVA:41)
At Org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection ( BASICCONNECTIONCREATOR.JAVA:58)
At Org.hibernate.engine.jdbc.connections.internal.PooledConnections.addConnections (pooledconnections.java:123)
At Org.hibernate.engine.jdbc.connections.internal.pooledconnections.<init> (PooledConnections.java:42)
At Org.hibernate.engine.jdbc.connections.internal.pooledconnections.<init> (PooledConnections.java:20)
At Org.hibernate.engine.jdbc.connections.internal.pooledconnections$builder.build (PooledConnections.java:161)
At Org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool ( DRIVERMANAGERCONNECTIONPROVIDERIMPL.JAVA:109)
At Org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure ( DRIVERMANAGERCONNECTIONPROVIDERIMPL.JAVA:72)
At Org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService ( standardserviceregistryimpl.java:94)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService ( abstractserviceregistryimpl.java:242)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (abstractserviceregistryimpl.java:210)
At Org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess ( jdbcenvironmentinitiator.java:145)
At Org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService ( JDBCENVIRONMENTINITIATOR.JAVA:66)
At Org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService ( JDBCENVIRONMENTINITIATOR.JAVA:35)
At Org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService ( STANDARDSERVICEREGISTRYIMPL.JAVA:88)
At Org.hibernate.service.internal.AbstractServiceRegistryImpl.createService (Abstractserviceregistryimpl.java : 259)
... More
caused By:java.sql.SQLException:The server time zone value ' öð¹ú±êx¼ê±¼ä ' are unrecognized or represents more than one TI Me zone. You are must configure either the server or JDBC driver (via the Servertimezone configuration) to use a more specifc Time zone value if your want to utilize time zone support.