Java 春天的错误

Java 春天的错误,java,eclipse,spring,maven,logback,Java,Eclipse,Spring,Maven,Logback,我试图在我的Spring项目中使用H2和hibernate存储数据, 我无法摆脱这个: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.AbstractMethodError: ch.qos.logback.classic.Logger.log(Lorg/

我试图在我的Spring项目中使用H2和hibernate存储数据, 我无法摆脱这个:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.AbstractMethodError: ch.qos.logback.classic.Logger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
我的pom文件:


怎么了?

来自Spring参考文档:

一个常见的选择可能是将Spring桥接到SLF4J,然后提供从SLF4J到SLF4J的显式绑定 Log4J。您需要提供4个依赖项(并排除现有的commons日志记录):桥, SLF4J API、与Log4J的绑定以及Log4J实现本身。在Maven你会这么做的 像这样


org.springframework
弹簧芯
4.1.0.1构建快照
公用记录
公用记录
org.slf4j
jcl-over-slf4j
1.5.8
org.slf4j
slf4j api
1.5.8
org.slf4j
slf4j-log4j12
1.5.8
log4j
log4j
1.2.14

您提到的slf4j依赖项和pom.xml中使用的spring core slf4j库之间一定存在版本不匹配


如果您使用的是eclipse,您可以在pom.xml中的Dependency Hierarchy选项卡中轻松检查(通过搜索)。

感谢您的帮助,我用这个替换了日志依赖项,但仍然出现了相同的错误
<dependencies>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.1.0.BUILD-SNAPSHOT</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.5.8</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.8</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.8</version>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
</dependency>