title: Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]
body: <p>I am trying to make a login portal by referencing this tutorial:</p>
  
  <p><a href="http://www.mkyong.com/spring-security/spring-security-form-login-using-database/" rel="nofollow noreferrer">http://www.mkyong.com/spring-security/spring-security-form-login-using-database/</a></p>
  
  <p>but as I wish to use Microsoft SQL Server instead of MySQL, I made some changes:</p>
  
  <p>spring-database.xml</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
      &lt;bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
  
          &lt;property name="driverClassName"
              value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /&gt;
          &lt;property name="url"
              value="jdbc:sqlserver://localhost:1433;integratedSecurity=true;databaseName=test" /&gt;
  
          &lt;!-- &lt;property name="username" value="root" /&gt; &lt;property name="password" 
              value="password" /&gt; --&gt;
  
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Then I got this problem when I was trying to run a project:</p>
  
  <blockquote>
    <p>17:20:47,680 ERROR [org.springframework.web.context.ContextLoader]
    (ServerService Thread Pool -- 132) Context initialization failed:
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'org.springframework.security.filterChains':
    Cannot resolve reference to bean
    'org.springframework.security.web.DefaultSecurityFilterChain#0' while
    setting bean property 'sourceList' with key [0]; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.web.DefaultSecurityFilterChain#0':
    Cannot resolve reference to bean
    'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0'
    while setting constructor argument with key [4]; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0':
    Cannot resolve reference to bean
    'org.springframework.security.authentication.ProviderManager#0' while
    setting bean property 'authenticationManager'; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.authentication.ProviderManager#0':
    Cannot resolve reference to bean
    'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0'
    while setting constructor argument; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0':
    FactoryBean threw exception on object creation; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.authenticationManager': Cannot resolve
    reference to bean
    'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0'
    while setting constructor argument with key [0]; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0':
    Cannot resolve reference to bean
    'org.springframework.security.provisioning.JdbcUserDetailsManager#0'
    while setting bean property 'userDetailsService'; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name
    'org.springframework.security.provisioning.JdbcUserDetailsManager#0':
    Cannot resolve reference to bean 'dataSource' while setting bean
    property 'dataSource'; nested exception is
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'dataSource' defined in ServletContext
    resource [/WEB-INF/spring-database.xml]: Error setting property
    values; nested exception is
    org.springframework.beans.PropertyBatchUpdateException; nested
    PropertyAccessExceptions (1) are: PropertyAccessException 1:
    org.springframework.beans.MethodInvocationException: Property
    'driverClassName' threw exception; nested exception is
    java.lang.IllegalStateException: Could not load JDBC driver class
    [com.microsoft.sqlserver.jdbc.SQLServerDriver]</p>
  </blockquote>
  
  <p>Then I think I should focus on this:</p>
  
  <blockquote>
    <p>org.springframework.beans.MethodInvocationException: Property
    'driverClassName' threw exception; nested exception is
    java.lang.IllegalStateException: Could not load JDBC driver class
    [com.microsoft.sqlserver.jdbc.SQLServerDriver]</p>
  </blockquote>
  
  <p>The thing is that I included the JDB Cdriver in my project, but why this error shown?</p>
  
  <p>The screenshot of the included driver
  <a href="https://i.stack.imgur.com/dJvTP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dJvTP.png" alt="enter image description here"></a></p>
  
  <p>I am using wildfly 14.0.1 as server.</p>