Es extraño. Acabo de cambiar algunas cosas en mi aplicación web y no puedo revertir las cosas porque no puedo recordar lo que he cambiado.No se puede encontrar la clase de registro de commons
Me estoy poniendo esta excepción al intentar ejecutar mi aplicación web:
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
Aquí es mi pom.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<name>example</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.1.RELEASE</spring.version>
<slf4j.version>1.6.4</slf4j.version>
</properties>
<dependencies>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Wro4j -->
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-extensions</artifactId>
<version>1.4.7</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.1.Final</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Apache Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSR 303 with Hibernate Validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- JSR 250 -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<!-- Custom tag libraries -->
<dependency>
<groupId>com.github.slugify</groupId>
<artifactId>slugify-taglib</artifactId>
<version>1.0-RELEASE</version>
</dependency>
<!-- Joda Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sólo recuerdo que he añadido Joda El tiempo y JSR 250 API pero ambos no tienen ninguna dependencia en el registro de commons?
Si necesita un código más, simplemente dígalo y lo proporcionaré.
EDITAR
árbol de dependencias:
[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
EDIT 2
Al comentar todas relacionadas resultados cosas a la seguridad de primavera en esta excepción en tiempo de ejecución (sustituyó a todas las exclusiones por commons-logging dependencia con alcance provided
):
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.<clinit>(ContextCleanupListener.java:43)
... 12 more
Enfrentando el mismo problema. ¿Dónde estaban 'tmp0' y' tmp1'? Y cómo rectas exactamente un espacio de trabajo en ¿Eclipse? ¿Quiere decir crear un nuevo espacio de trabajo? – arun
Hm eso es hace mucho tiempo. Puedo encontrar una carpeta tmp0 aquí: '.metadata/.plugins/org.eclipse.wst.server.core' - pero no sé cómo recreó el espacio de trabajo más. Lo siento. – dtrunk
Ok, no hay problema.Terminé borrando maven repo en '~/.m2' y actualicé las dependencias de maven a través de Eclipse y comenzó a funcionar bien. Había hecho un poco de limpieza usando comandos de línea de comando mvn en un proyecto de eclipse que estaba usando m2eclipse. Parece que los comandos m2eclipse y mvn no funcionan bien juntos. – arun