[logback-user] Jetty conflict

Aleksey Didik didik at magenta-technology.ru
Thu Feb 4 10:54:07 CET 2010


 >> Jetty used to have the opposite class loading order, i.e. parent-first
 >But if is it truth, it's a straight way to have problems like mine, 
isn't it?

No, I'm not right. Parent-first is preferable in my situation, because 
slf4j classes for webapp will be loaded from jetty class loader in this 
case, and no conflict here...
Yes, I tried to change my embedded jetty class loading order to parent 
first and all works as I need with slf4j-only-WAR.

But I  tried to deploy slf4j-only-WAR to tomcat with slf4j+logback in 
Tomcat libs and caught the same linkage error. Tomcat use local-first 
order by default :)

I think I can use embedded jetty with parent-first order and 
slf4j-only-WAR, but in this case I can't use this WAR in another contaners.

Ok, I'll have logback+slf4j in my WAR.

Thanks a lot for the help,
Aleksey.






04.02.2010 12:52, Ceki Gülcü пишет:
> By the way, if the document on Jetty's class loading architecture [1] 
> is accurate, than jetty uses local-first class loading as required by 
> the servlet specs but with exceptions. Indeed, since jetty uses slf4j 
> internally, it is part of what is called the "server classes" which 
> jetty does NOT export to web-apps. So, bundling slf4j-api, 
> logback-core and logback-classic in your web-app should work fine.
>
> Interestingly enough, jetty considers org.apache.log4j and 
> org.apache.commons.logging as *system* classes which the web-app 
> cannot override. I am sure there are good reasons for this strategy 
> but it does not affect slf4j users, unless of course they are using 
> log4j or if they are using jcl-over-slf4j.
>
> Yes, it's complicated...
>
>
>
> [1] http://docs.codehaus.org/display/JETTY/Classloading
>
> On 04/02/2010 9:41 AM, Ceki Gülcü wrote:
>>
>> Assuming jetty uses child-first a.k.a. local-first class loading order,
>> I would recommend to bundle slf4j and logback jar in your war file.
>>
>> Jetty used to have the opposite class loading order, i.e. parent-first,
>> but I am under the impression that it changed to local-first class
>> loading in recent versions.
>>
>> BTW, Tomcat uses local-first class loading by default.
>>
>> HTH,
>>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list