1

I'm trying to make a connection to a MySQL server within Spring Boot, using Spring Tool Suite. Even though my database is running and the schema is created, I get the following error:

WARN 44756 --- [  restartedMain] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.

ERROR 44756 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool       : HikariPool-1 - Exception during pool initialization.

WARN 44756 --- [  restartedMain] o.s.b.a.orm.jpa.DatabaseLookup           : Unable to determine jdbc url from datasource

WARN 44756 --- [  restartedMain] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : The server time zone value 'PDT' 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.

WARN 44756 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

I'm using the following application.properties:

spring.datasource.url=jdbc:mysql://localhost:3306/book-schema
spring.datasource.username=root spring.datasource.password=root1234
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update

I'm not sure what's causing this issue.

g00glen00b
  • 41,995
  • 13
  • 95
  • 133
deadbeat253
  • 47
  • 1
  • 10
  • add the application.properties,pom.xml and hibernate configuration file(if exists) – Alien Nov 05 '18 at 05:53
  • i have the application.properties file as follows: spring.datasource.url=jdbc:mysql://localhost:3306/book-schema spring.datasource.username=root spring.datasource.password=root1234 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.jpa.hibernate.ddl-auto=update not sure about the hibernate config file? – deadbeat253 Nov 05 '18 at 06:00
  • mysql connector version and spring boot version in pom.xml? – Alien Nov 05 '18 at 06:02
  • no version is specified! – deadbeat253 Nov 05 '18 at 06:05

1 Answers1

3

Try adding timezone like below.

spring.datasource.url=jdbc:mysql://localhost:3306/book-schema?serverTimezone=UTC

Refer time-zone-issue

Alien
  • 15,141
  • 6
  • 37
  • 57