[logback-user] Jetty conflict

Ceki Gulcu ceki at qos.ch
Wed Feb 3 18:46:41 CET 2010

Hello Aleksey,

I am not totally surprised by what you describe. According to the java
laguage specification (JLS) two classes loaded by distinct class
loaders are deemed incompatible even if the classes are bitwise

When the jetty class loader loads ch.qos.classic.Logger it also needs
to load org.slf4j.Logger which it can, and does. When the
ch.qos.classic.Logger is returned to your web-application as a
org.slf4j.Logger as requested by your web-application, the returned
Logger is not compatible with the expected Logger, even if they are
both of type org.slf4j.Logger. Your web-application expects it to be
loaded by the web-app's class loader but the returned instance is loaded
by the jetty class loader, hence the error you observe.


On 03.02.2010 18:36, Aleksey Didik wrote:
> Hello,
> I have caught a problem of using embedded Jetty and slf4j, may be you
> can help me.
> Jetty tell me this one:
> java.lang.LinkageError: loader constraint violation: when resolving
> method
> "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;"
> the
> class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) of
> the current class, org/slf4j/LoggerFactory, and the class loader
> (instance of sun/misc
> /Launcher$AppClassLoader) for resolved class,
> org/slf4j/impl/StaticLoggerBinder, have different Class objects for the
> type org/slf4j/ILoggerFactory used in the
> signature [main o.e.j.u.l.Slf4jLog.warn:111]
> I have next jars:
> Embedded Jetty classpath:
> slf4j-api-1.5.10.jar
> logback-classic-0.9.18.jar
> War libs:
> slf4j-api-1.5.10.jar
> But I add
> slf4j-api-1.5.10.jar
> logback-classic-0.9.18.jar
> to WAR libs and delete
> logback-classic-0.9.18.jar
> from jetty classpath, all work fine.
> Best regards,
> Aleksey Didik

More information about the Logback-user mailing list