读书人

Resin3跟4对slf4j的要求

发布时间: 2012-12-27 10:17:10 作者: rapoo

Resin3和4对slf4j的要求

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的时候

读书人网 >编程

热点推荐