SLF4J版本兼容问题

来源:互联网 发布:数据结构算法题不会做 编辑:程序博客网 时间:2024/04/30 06:02
struts-2.3.8,spring 3.2.1,hibernate-distribution-3.6.6.Final,displytag 1.2,整合,遇到以下SLF4J问题:
【现象一】
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
     at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:173)

【现象二】
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
2013-3-19 17:12:31 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;

【原因及解决办法】
原因就是slf4j-api-1.6.6.jar、slf4j-log4j12-1.6.6.jar、jcl-over-slf4j-1.6.6.jar  这3个JAR包的版本不同。

【C3P0错误】
将上述3个包统一版本后,又发生了如下异常:
2013-03-19 19:40:44,340 - org.hibernate.util.JDBCExceptionReporter -625  [Thread-5] ERROR  - An attempt by a client to checkout a Connection has timed out.
2013-03-19 19:40:44,465 - org.hibernate.cfg.SettingsFactory -750  [Thread-5] WARN   - Could not obtain connection to query metadata
java.sql.SQLException : An attempt by a client to checkout a Connection has timed out.

原因及解决办法
在ApplicationContext.xml中设置属性checkoutTimeout的值过小,修改为默认值0,问题解决!
<property name="checkoutTimeout" value="0"/>


原创粉丝点击