title: Could not initialize class org.springframework.jdbc.core.StatementCreatorUtils
body: <p>My app does not include the org.springframework.ws dependency. It seems to be a jdbc issue.</p>
  
  <p>Writing a web app and practicing security. this message comes up when I try to login to a mysql database called testdatabase.</p>
  
  <p>The stack trace is as follows:</p>
  
  <pre><code>SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [/SpringSecurityTut1] threw exception [Filter execution threw an exception] with root cause
  java.lang.NoClassDefFoundError: Could not initialize class org.springframework.jdbc.core.StatementCreatorUtils
      at org.springframework.jdbc.core.ArgumentPreparedStatementSetter.cleanupParameters(ArgumentPreparedStatementSetter.java:72)
      at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:713)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:737)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:787)
      at org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl.loadUsersByUsername(JdbcDaoImpl.java:192)
      at org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl.loadUserByUsername(JdbcDaoImpl.java:151)
      at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:102)
      at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:132)
      at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
      at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:177)
      at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:92)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:211)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:105)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
  </code></pre>
  
  <p>This is my SecurityConfig class:</p>
  
  <pre><code>@Configuration
  @EnableWebMvcSecurity
  @EnableWebSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private DataSource dataSource;
      @Autowired
      public void congigureGlobal(AuthenticationManagerBuilder auth) throws Exception {
  
          auth
              .jdbcAuthentication()
              .dataSource(dataSource);
      }
  
  
      public void configure(HttpSecurity http) throws Exception {
  
  
          http            
              .authorizeRequests()
              .antMatchers("/login").permitAll()
              .antMatchers("/admin").hasRole("ADMIN")
              .anyRequest().authenticated()
              .and()
              .formLogin()
                  .loginPage("/login").and().httpBasic();
      }
  }
  </code></pre>
  
  <p>This is my application-config file</p>
  
  <pre><code>&lt;context:component-scan
      base-package="com.springsecurityexample"/&gt;
  
  &lt;context:property-placeholder 
      location="classpath*:spring/*.properties"/&gt;
  
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
  
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
      &lt;property name="url" value="jdbc:mysql://localhost:3306/testdatabase"/&gt;
      &lt;property name="username" value="test"/&gt;
      &lt;property name="password" value="test123"/&gt;           
  
  &lt;/bean&gt;
  </code></pre>
  
  <p>Once I click my login button the error occurs. Similar questions on stackoverflow seem to indicate a dependency problem but all dependencies seem to be in place.</p>