Resin4对 slf4j的要求是version 1.6+,所以如果3换4的话要记得升级jar包,否则活抛异常,异常信息如下:
NoSuchMethodError: StaticLoggerBinder.getSingleton()
对应的org.slf4j.LoggerFactory源码如下:
private final static void bind() {
try {
// the next line does the binding
StaticLoggerBinder.getSingleton();
INITIALIZATION_STATE = SUCCESSFUL_INITILIZATION;
emitSubstituteLoggerWarning();
} catch (NoClassDefFoundError ncde) {
String msg = ncde.getMessage();
if (msg != null && msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != -1) {
INITIALIZATION_STATE = NOP_FALLBACK_INITILIZATION;
Util
.report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
Util.report("Defaulting to no-operation (NOP) logger implementation");
Util.report("See " + NO_STATICLOGGERBINDER_URL
+ " for further details.");
} else {
failedBinding(ncde);
throw ncde;
}
} catch(java.lang.NoSuchMethodError nsme) {
String msg = nsme.getMessage();
if (msg != null && msg.indexOf("org.slf4j.impl.StaticLoggerBinder.getSingleton()") != -1) {
INITIALIZATION_STATE = FAILED_INITILIZATION;
Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding.");
Util.report("Your binding is version 1.5.5 or earlier.");
Util.report("Upgrade your binding to version 1.6.x. or 2.0.x");
}
throw nsme;
} catch (Exception e) {
failedBinding(e);
throw new IllegalStateException("Unexpected initialization failure", e);
}
}
在进行bind的时候
本文介绍了Resin4应用服务器与Slf4j日志框架之间的版本兼容性问题,当Resin4所需的Slf4j版本为1.6+时,使用早期版本会导致NoSuchMethodError异常。文章提供了异常的详细信息及解决方法。
2775

被折叠的 条评论
为什么被折叠?



