使用ehcache2.2.0碰到的slf4j版本问题

在使用ehcache时候碰到如下错误
SLF4J: The requested version 1.5.11 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Jun 25, 2012 10:39:11 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [bbs] in context with path [/bbsui] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;] with root cause
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
	at org.slf4j.impl.JDK14LoggerAdapter.warn(JDK14LoggerAdapter.java:405)
	at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:134)
	at net.sf.ehcache.CacheManager.parseConfiguration(CacheManager.java:506)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:290)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:280)
	at net.sf.ehcache.CacheManager.create(CacheManager.java:642)


错误信息提示slf4j版本不对。原因是工程中依赖的slf4j-jdk14版本是1.5.11,而slf4j-api版本是1.6.3,导致slf4j-jdk14中的JDK14LoggerAdapter调用了slf4j-api中的MessageFormatter参数不对。
解决方法将slf4j-jdk14版本和slf4j-api版本改的一致即可。

你可能感兴趣的:(ehcache)