I'm going to guess you might have a classpath issue. If you're putting SLF4J in the parent classpath (TOMCAT/lib), I don't think it will be able to look into a child for the binding (logback). I think it would only work the other way.
I am not a Tomcat classpath expert though as I haven't used Tomcat in a while and even then we rarely put JARs outside the app itself. On Fri, Feb 6, 2015 at 3:00 PM, Baron Fujimoto <ba...@hawaii.edu> wrote: > I eventually came up with something that works that's basically consistent > with what I think you're saying, though I'm not sure about transitively > getting the slf4j-api class since I encountered a fatal error until I > explicitly provided that myself. > > As for the binding, my initial thought was to use whatever the main idp > app was using (logback), but even there I'm confused by the the > combination of situations I encountered: if I don't provide a binding, it > warns and defaults to NOP; if I provide a logback binding, it complains > of conflict and barfs; and if I provide an non-logback alternate binding, > it notes the multiple bindings and choose the main app's logback binding > (where it previously did not pick it up in the NOP case). > > So this is where I question my approach to resolving this. I mean, it > seems to work, but it doesn't seem like this is the right way to go about > it. Ideally it seems like it should pick up or re-use the binding provided > in the idp war, but I don't know how you do that. > > -baron > > On Fri, Feb 06, 2015 at 01:16:07PM -0500, Scott Battaglia wrote: > >SLF4J is very similar to Commons Logging in that there is an API jar and > >then one or more implementations/bindings. > > > >You should have transitively gotten the slf4j-api class (since we would > >have to compile against it) and you would have to provide the binding that > >maps to your logger of choice (Logback is one common one): > >http://www.slf4j.org/manual.html > > > >On Thu, Feb 5, 2015 at 10:16 PM, Baron Fujimoto <ba...@hawaii.edu> wrote: > > > >> We're using the Java cas-client (3.3.3) to provide RemoteUser > >> authentication for our Shibboleth IdP service. > >> > >> This version seems of the cas-client seems to require slf4j where our > >> previously used version (3.2.1) didn't(?). I encountered the the > following > >> error until I put a copy of slf4j-api-1.7.10.jar in out > {tomcat_base}/lib > >> directory: > >> > >> ===== > >> ~/tomcat/lib/ > >> 106079 Sep 9 17:46 cas-client-core-3.3.3.jar > >> SEVERE: Exception loading sessions from persistent storage > >> java.lang.NoClassDefFoundError: Lorg/slf4j/Logger; > >> [...] > >> ===== > >> > >> Then I discovered that unless I also provided a binding for a logging > >> framework, it generates the warning: > >> > >> ===== > >> ~/tomcat/lib/ > >> Sep 9 17:46 cas-client-core-3.3.3.jar > >> Jan 6 10:15 slf4j-api-1.7.10.jar > >> > >> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". > >> SLF4J: Defaulting to no-operation (NOP) logger implementation > >> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for > further > >> details. > >> ===== > >> > >> The IdP war includes the logback-core binding, but apparently that > doesn't > >> get picked up: > >> > >> ~/idp/war/idp.war!/WEB-INF/lib/logback-core-1.0.11.jar > >> > >> If I include the logback-core binding from the slf4j-1.7.10 distribution > >> it generates the fatal error: > >> > >> ===== > >> ~/tomcat/lib/ > >> 106079 Sep 9 17:46 cas-client-core-3.3.3.jar > >> 270747 Apr 2 2014 logback-classic-1.1.2.jar > >> 32119 Jan 6 10:15 slf4j-api-1.7.10.jar > >> > >> SLF4J: Class path contains multiple SLF4J bindings. > >> SLF4J: Found binding in > >> > [jar:file:/home/shib/tomcat/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] > >> SLF4J: Found binding in > >> > [jar:war:file:/home/shib/idp/war/idp.war^/WEB-INF/lib/logback-classic-1.0.11.jar!/org/slf4j/impl/StaticLoggerBinder.class] > >> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an > >> explanation. > >> SLF4J: Actual binding is of type > >> [ch.qos.logback.classic.util.ContextSelectorStaticBinder] > >> Failed to instantiate SLF4J LoggerFactory > >> Reported exception: > >> java.lang.NoClassDefFoundError: > >> ch/qos/logback/core/joran/spi/JoranException > >> at org.slf4j.LoggerFactory.bind(LoggerFactory.java:142) > >> [...] > >> ===== > >> > >> Finally, I settled on using the simple binding, since that only > generates > >> a warning and seems to fall back on logback (From the idp.war? Now it > >> picks it up?) > >> > >> ===== > >> ~/tomcat/lib/ > >> 106079 Sep 9 17:46 cas-client-core-3.3.3.jar > >> 32119 Jan 6 10:15 slf4j-api-1.7.10.jar > >> 10705 Jan 6 10:15 slf4j-simple-1.7.10.jar > >> > >> SLF4J: Class path contains multiple SLF4J bindings. > >> SLF4J: Found binding in > >> > [jar:file:/home/shib/tomcat/lib/slf4j-simple-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] > >> SLF4J: Found binding in > >> > [jar:war:file:/home/shib/idp/war/idp.war^/WEB-INF/lib/logback-classic-1.0.11.jar!/org/slf4j/impl/StaticLoggerBinder.class] > >> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an > >> explanation. > >> SLF4J: Actual binding is of type > >> [ch.qos.logback.classic.util.ContextSelectorStaticBinder]====== > >> > >> I only arrived at this through a series of empirical experiments. I'd > >> appreciate any advice on the recommended way to properly deal with this > >> though. > >> > >> Aloha, > >> -baron > >> -- > >> Baron Fujimoto <ba...@hawaii.edu> :: UH Information Technology Services > >> minutas cantorum, minutas balorum, minutas carboratum desendus pantorum > >> > >> -- > >> You are currently subscribed to cas-user@lists.jasig.org as: > >> scott.battag...@gmail.com > >> To unsubscribe, change settings or access archives, see > >> http://www.ja-sig.org/wiki/display/JSG/cas-user > >> > > > >-- > >You are currently subscribed to cas-user@lists.jasig.org as: > ba...@hawaii.edu > >To unsubscribe, change settings or access archives, see > http://www.ja-sig.org/wiki/display/JSG/cas-user > > -- > Baron Fujimoto <ba...@hawaii.edu> :: UH Information Technology Services > minutas cantorum, minutas balorum, minutas carboratum desendus pantorum > > -- > You are currently subscribed to cas-user@lists.jasig.org as: > scott.battag...@gmail.com > To unsubscribe, change settings or access archives, see > http://www.ja-sig.org/wiki/display/JSG/cas-user > -- You are currently subscribed to cas-user@lists.jasig.org as: arch...@mail-archive.com To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user