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 <[email protected]> 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 <[email protected]> :: UH Information Technology Services
> minutas cantorum, minutas balorum, minutas carboratum desendus pantorum
>
> --
> You are currently subscribed to [email protected] as:
> [email protected]
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to