title: Cannot find commons logging class
body: <p>It's strange. I just changed some stuff in my web application and can't revert the stuff because I can't remember what I've changed.</p>
  
  <p>I'm getting this exception when trying to run my webapp:</p>
  
  <pre><code>Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:270)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
      ... 12 more
  </code></pre>
  
  <p>Here's my 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/maven-v4_0_0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;example&lt;/artifactId&gt;
      &lt;name&gt;example&lt;/name&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0-BUILD-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.6&lt;/java.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;spring.version&gt;3.1.1.RELEASE&lt;/spring.version&gt;
          &lt;slf4j.version&gt;1.6.4&lt;/slf4j.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;cglib&lt;/groupId&gt;
              &lt;artifactId&gt;cglib&lt;/artifactId&gt;
              &lt;version&gt;2.2.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                   &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                   &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;                       
          &lt;/dependency&gt;
  
          &lt;!-- Wro4j --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ro.isdc.wro4j&lt;/groupId&gt;
              &lt;artifactId&gt;wro4j-extensions&lt;/artifactId&gt;
              &lt;version&gt;1.4.7&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Logging --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;4.1.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;version&gt;9.1-901-1.jdbc4&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Servlet --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Apache Tiles --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tiles&lt;/groupId&gt;
              &lt;artifactId&gt;tiles-jsp&lt;/artifactId&gt;
              &lt;version&gt;2.2.2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging-api&lt;/artifactId&gt;
                   &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;!-- JSR 303 with Hibernate Validator --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.GA&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;4.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- JSR 250 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
              &lt;artifactId&gt;jsr250-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Test --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.10&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Custom tag libraries --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.github.slugify&lt;/groupId&gt;
              &lt;artifactId&gt;slugify-taglib&lt;/artifactId&gt;
              &lt;version&gt;1.0-RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Joda Time --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;joda-time&lt;/groupId&gt;
              &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${java.version}&lt;/source&gt;
                      &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I just remember that I added Joda Time and JSR 250 API but both doesn't have any dependency on commons-logging?!</p>
  
  <p>If some more code is needed just tell and I'll provide.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Dependency tree:</p>
  
  <pre><code>[INFO] +- cglib:cglib:jar:2.2.2:compile
  [INFO] |  \- asm:asm:jar:3.3.1:compile
  [INFO] +- commons-logging:commons-logging:jar:1.1.1:provided (scope not updated to compile)
  [INFO] +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework:spring-orm:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
  [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:compile
  [INFO] |  +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework.security:spring-security-web:jar:3.1.1.RELEASE:compile
  [INFO] |  \- org.springframework.security:spring-security-core:jar:3.1.1.RELEASE:compile
  [INFO] +- org.springframework.security:spring-security-config:jar:3.1.1.RELEASE:compile
  [INFO] +- ro.isdc.wro4j:wro4j-extensions:jar:1.4.7:compile
  [INFO] |  +- ro.isdc.wro4j:wro4j-core:jar:1.4.7:compile
  [INFO] |  +- org.apache.commons:commons-lang3:jar:3.1:compile
  [INFO] |  +- commons-io:commons-io:jar:2.1:compile
  [INFO] |  +- commons-pool:commons-pool:jar:1.6:compile
  [INFO] |  +- com.google.code.gson:gson:jar:1.6:compile
  [INFO] |  +- com.google.javascript:closure-compiler:jar:r1918:compile
  [INFO] |  |  +- args4j:args4j:jar:2.0.12:compile
  [INFO] |  |  +- com.google.guava:guava:jar:10.0.1:compile
  [INFO] |  |  +- com.google.protobuf:protobuf-java:jar:2.4.1:compile
  [INFO] |  |  +- org.json:json:jar:20090211:compile
  [INFO] |  |  +- org.apache.ant:ant:jar:1.8.2:compile
  [INFO] |  |  |  \- org.apache.ant:ant-launcher:jar:1.8.2:compile
  [INFO] |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
  [INFO] |  |  \- com.googlecode.jarjar:jarjar:jar:1.1:compile
  [INFO] |  +- org.mozilla:rhino:jar:1.7R3:compile
  [INFO] |  +- com.github.lltyk:dojo-shrinksafe:jar:1.7.2:compile
  [INFO] |  +- org.jruby:jruby-complete:jar:1.6.7.2:compile
  [INFO] |  +- me.n4u.sass:sass-gems:jar:3.1.16:compile
  [INFO] |  +- nz.co.edmi:bourbon-gem-jar:jar:2.1.0:compile
  [INFO] |  \- org.codehaus.gmaven.runtime:gmaven-runtime-1.7:jar:1.3:compile
  [INFO] |     +- org.codehaus.gmaven.feature:gmaven-feature-support:jar:1.3:compile
  [INFO] |     |  \- org.codehaus.gmaven.feature:gmaven-feature-api:jar:1.3:compile
  [INFO] |     +- org.codehaus.gmaven.runtime:gmaven-runtime-support:jar:1.3:compile
  [INFO] |     |  +- org.codehaus.gmaven.runtime:gmaven-runtime-api:jar:1.3:compile
  [INFO] |     |  +- org.sonatype.gshell:gshell-io:jar:2.0:compile
  [INFO] |     |  +- org.codehaus.plexus:plexus-utils:jar:2.0.1:compile
  [INFO] |     |  \- com.thoughtworks.qdox:qdox:jar:1.10:compile
  [INFO] |     +- org.codehaus.groovy:groovy-all:jar:1.7.4:compile
  [INFO] |     \- jline:jline:jar:0.9.94:compile
  [INFO] +- org.slf4j:slf4j-api:jar:1.6.6:compile
  [INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.6:compile
  [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.6:runtime (scope not updated to compile)
  [INFO] +- log4j:log4j:jar:1.2.17:runtime
  [INFO] +- org.hibernate:hibernate-core:jar:4.1.1.Final:compile
  [INFO] |  +- antlr:antlr:jar:2.7.7:compile
  [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
  [INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
  [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
  [INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
  [INFO] |  +- org.javassist:javassist:jar:3.15.0-GA:compile
  [INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
  [INFO] +- postgresql:postgresql:jar:9.1-901-1.jdbc4:compile
  [INFO] +- javax.servlet:servlet-api:jar:2.5:provided
  [INFO] +- javax.servlet:jstl:jar:1.2:compile
  [INFO] +- org.apache.tiles:tiles-jsp:jar:2.2.2:compile
  [INFO] |  +- org.apache.tiles:tiles-servlet:jar:2.2.2:compile
  [INFO] |  |  \- org.apache.tiles:tiles-core:jar:2.2.2:compile
  [INFO] |  |     \- commons-digester:commons-digester:jar:2.0:compile
  [INFO] |  |        \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
  [INFO] |  \- org.apache.tiles:tiles-template:jar:2.2.2:compile
  [INFO] |     \- org.apache.tiles:tiles-api:jar:2.2.2:compile
  [INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
  [INFO] +- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
  [INFO] +- javax.annotation:jsr250-api:jar:1.0:compile
  [INFO] +- junit:junit:jar:4.10:test (scope not updated to compile)
  [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
  [INFO] +- org.springframework:spring-test:jar:3.1.1.RELEASE:test
  [INFO] +- commons-dbcp:commons-dbcp:jar:1.4:test
  [INFO] +- com.github.slugify:slugify-taglib:jar:1.0-RELEASE:compile
  [INFO] |  \- com.github.slugify:slugify:jar:1.0-RELEASE:compile
  [INFO] |     \- commons-lang:commons-lang:jar:2.6:compile
  [INFO] \- joda-time:joda-time:jar:2.1:compile
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>Commenting out all spring-security related stuff results in this runtime exception (replaced all exclusions by commons-logging dependency with scope <code>provided</code>):</p>
  
  <pre><code>Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
  java.lang.ExceptionInInitializerError
      at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:144)
      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
      at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
      at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:303)
      at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
      at org.springframework.web.context.ContextCleanupListener.&lt;clinit&gt;(ContextCleanupListener.java:43)
      ... 12 more
  </code></pre>