title: spring boot database error datasource "org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration”
body: <p>I am using the spring boot, hibernate and the my sql and i am getting the error.</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.UnsatisfiedDependencyException:
    Error creating bean with name
    'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
    Unsatisfied dependency expressed through constructor parameter 0;
    nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'dataSource' defined in class path resource
    [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
    Bean instantiation via factory method failed; nested exception is
    org.springframework.beans.BeanInstantiationException: Failed to
    instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method
    'dataSource' threw exception; nested exception is
    java.lang.IllegalStateException: Cannot load driver class:
    com.mysql.jdbc.Driver at
    org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1267)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1124)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089)
    ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859)
    ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)
    [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
    [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.SpringApplication.run(SpringApplication.java:333)
    [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
    [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
    [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    com.trial.TrialApplication.main(TrialApplication.java:15)
    [classes/:na] Caused by:
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'dataSource' defined in class path resource
    [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
    Bean instantiation via factory method failed; nested exception is
    org.springframework.beans.BeanInstantiationException: Failed to
    instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method
    'dataSource' threw exception; nested exception is
    java.lang.IllegalStateException: Cannot load driver class:
    com.mysql.jdbc.Driver at
    org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] ... 28 common frames
    omitted Caused by:
    org.springframework.beans.BeanInstantiationException: Failed to
    instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method
    'dataSource' threw exception; nested exception is
    java.lang.IllegalStateException: Cannot load driver class:
    com.mysql.jdbc.Driver at
    org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] ... 41 common frames
    omitted Caused by: java.lang.IllegalStateException: Cannot load driver
    class: com.mysql.jdbc.Driver at
    org.springframework.util.Assert.state(Assert.java:94)
    ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE] at
    org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:224)
    ~[spring-boot-autoconfigure-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:176)
    ~[spring-boot-autoconfigure-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:43)
    ~[spring-boot-autoconfigure-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:83)
    ~[spring-boot-autoconfigure-2.0.5.RELEASE.jar:2.0.5.RELEASE] at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ~[na:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
    Source) ~[na:1.8.0_181] at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    ~[na:1.8.0_181] at java.lang.reflect.Method.invoke(Unknown Source)
    ~[na:1.8.0_181] at
    org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE] ... 42 common frames
    omitted</p>
  </blockquote>
  
  <p>pom.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.bookstore&lt;/groupId&gt;
      &lt;artifactId&gt;bookstore&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;name&gt;bookstore&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.0.5.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>entity class is </p>
  
  <pre><code>package com.trial.hibernate;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  
  
  @Entity
  public class Employee {
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private int id;
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getPhone() {
          return phone;
      }
      public void setPhone(String phone) {
          this.phone = phone;
      }
      private String name;
      private String phone;
  
  }
  </code></pre>
  
  <p>properties file is</p>
  
  <pre><code>server.port=8181
  spring.thymeleaf.cache=false
  # create and drop tables and sequences, loads import.sql
  spring.jpa.hibernate.ddl-auto=create
  # database settings
  spring.datasource.url=jdbc:mysql://localhost:3306/bookstore?useSSL=false
  spring.datasource.username=root
  spring.datasource.password=oracle
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.jpa.show-sql=true
  </code></pre>
  
  <p>the github repository link is <a href="https://github.com/dishankgoyal/springsBoot" rel="nofollow noreferrer">https://github.com/dishankgoyal/springsBoot</a></p>
  
  <p>How can i fix this?</p>