title: java.lang.IllegalStateException: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
body: <p>I have created this java application using spring boot on IDE IntelliJ
  following are my configuration files. Application builds successfully but I get this error:<br/></p>
  
  <blockquote>
    <p>Caused by: java.lang.IllegalStateException: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver</p>
  </blockquote>
  
  <p>worked around this,<br/>
  added jar to classpath but didn't work
  <br/>
  application.properties</p>
  
  <pre><code># port
  server.port=7031
  
  # ms sql database
  spring.datasource.url=jdbc:sqlserver://0.0.0.0:1433;databaseName=PEOPLEHUM
  spring.datasource.username=sa
  spring.datasource.password=mssql@123
  spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
  spring.jpa.show-sql=true
  spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
  spring.jpa.hibernate.ddl-auto=update
  
  spring.jpa.properties.hibernate.format_sql=true
  logging.level.org.hibernate.SQL=DEBUG
  logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
  
  spring.batch.job.enabled=false
  
  # cron value for executor
  scheduled.job.attendance.logs.cron=0 0 0/12 ? * *
  
  # Logging pattern for file
  logging.pattern.file= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%
  logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%
  
  # output to a C:/peoplehum/logs/
  logging.path=C:/peoplehum/logs/
  logging.file=C:/peoplehum/logs/logs.log
  logging.file.max-size=10MB
  </code></pre>
  
  <p>build.gradle</p>
  
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.2.0.RELEASE'
      id 'io.spring.dependency-management' version '1.0.8.RELEASE'
      id 'java'
  }
  
  group = 'com.peoplehum'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  configurations {
      compileOnly {
          extendsFrom annotationProcessor
      }
  }
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-jdbc'
      implementation 'org.springframework.boot:spring-boot-starter-web'
  
      runtimeOnly 'org.springframework.boot:spring-boot-devtools'
      compile group: 'net.sf.ucanaccess', name: 'ucanaccess', version: '4.0.4'
      compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.4'
      compile group: 'com.squareup.okhttp', name: 'okhttp', version: '2.3.0'
      compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
      compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.12.1'
      compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.1'
      testCompile group: 'com.microsoft.sqlserver', name: 'sqljdbc4', version: '4.0'
  
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
  
      compileOnly 'org.projectlombok:lombok'
  
      annotationProcessor 'org.projectlombok:lombok'
  
      testImplementation('org.springframework.boot:spring-boot-starter-test') {
          exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
      }
  }
  
  test {
      useJUnitPlatform()
  }
  
  bootJar {
      launchScript()
  }
  </code></pre>
  
  <p>I have gone through many solutions available on web but nothing worked for me</p>
  
  <p>After Zakir's suggestion I updated my driver dependency following error is still coming:
  sorry, already tried</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inMemoryDatabaseShutdownExecutor' defined in class path resource [org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'inMemoryDatabaseShutdownExecutor' 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.microsoft.sqlserver.jdbc.SQLServerDriver
  </code></pre>