[ 
https://issues.apache.org/jira/browse/JCR-4796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553725#comment-17553725
 ] 

Graham Leggett commented on JCR-4796:
-------------------------------------

{quote}There are multiple misunderstandings here:
 * Maven dependencies for regular JR modules are just relevant at compile time 
(not at runtime)
 * SLF4J-API is not an SLF4J binding 
([https://www.slf4j.org/manual.html#swapping])
 * The JR webapp (WAR) comes with Logback as binding 
([https://github.com/apache/jackrabbit/blob/5196aab46fc4706198cdcd7c80cc3f5829e6e580/jackrabbit-webapp/pom.xml#L77]),
 try to remove that binding in case it conflicts with the servlet container 
classloader in any way (you haven't shared details about with which container 
you try to run which version of the JR webapp){quote}
Unfortunately it looks like the logging dependencies are bleeding through into 
the application. In a system like java where classloaders form a hierarchy, 
this causes chaos.

Ideally the libraries should log nothing, but failing that if logging is 
necessary, the absolute minimum code should be used to log, and that's 
java.util.logging.

In my case I'm only deploying jackrabbit-jcr2dav and jackrabbit-spi2dav - no 
wars, nothing extra yet, and none of this works out the box. I want to fix this 
by reverting to JUL at the lowest levels.
{quote}In general the issue tracker is no place to raise questions, please use 
the mailing list for that. Also notice that Open-Source is driven by 
volunteers, complaining too much usually does not help, while constructive 
criticism (concrete bug reports, PRs with bug fixes) are highly appreciated.
{quote}
Please google the person you're talking to before posting feedback like this. 
[https://people.apache.org/committer-index.html#minfrin]

I've spent days getting past the logging, more days finding and fixing an SSL 
regression, and now I'm picking apart the test suite to make sure the SSL fix 
is tested properly. I spend most of my time fixing bugs, I'd appreciate some 
help.
{quote}{color:#172b4d}Trying to explain again...: Jackrabbit modules use the 
SLF4J API. This is a compile time dependency. At runtime, they need an 
implementation of that API. This gives you the ability to use whatever logger 
you want (as long there is a SLF4J binding for it).{color}
{quote}
{color:#172b4d}Right now the problem is not a missing implementation, but two 
competing implementations of slf4j clashing with each other.{color}

{color:#172b4d}At the very least, the slf4j dependency needs to be stopped from 
bleeding through by declaring it provided, or tracing which upstream library is 
allowing it to bleed through and declaring it provided.{color}

Moving on to the test suite, when the jackrabbit test suite is run from within 
Eclipse, we get this logged complaining about multiple slf4j bindings, and 
nothing logged from the test itself:
{code:java}
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/Users/minfrin/.m2/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/Users/minfrin/.m2/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
13:58:02,992 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found 
resource [logback-test.xml] at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-spi2dav/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs multiple times on the classpath.
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-spi-commons/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-jcr2spi/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-webdav/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-jcr-server/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-spi2dav/target/test-classes/logback-test.xml]
13:58:02,993 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource 
[logback-test.xml] occurs at 
[file:/Users/minfrin/src/apache/sandbox/jackrabbit/rackjabbit-trunk/jackrabbit-core/target/test-classes/logback-test.xml]
13:58:03,205 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction 
- debug attribute not set
13:58:03,206 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About 
to instantiate appender of type [ch.qos.logback.core.FileAppender]
13:58:03,222 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming 
appender as [file]
13:58:03,232 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA 
- Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] 
for [encoder] property
13:58:03,284 |-INFO in ch.qos.logback.core.FileAppender[file] - File property 
is set to [target/jcr.log]
13:58:03,286 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - 
Setting level of ROOT logger to DEBUG
13:58:03,286 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - 
Attaching appender named [file] to Logger[ROOT]
13:58:03,286 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction 
- End of configuration.
13:58:03,287 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6a03bcb1 
- Registering current configuration as safe fallback point

SLF4J: Actual binding is of type 
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
{code}
 

> Remove slf4j from Jackrabbit libraries
> --------------------------------------
>
>                 Key: JCR-4796
>                 URL: https://issues.apache.org/jira/browse/JCR-4796
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>            Reporter: Graham Leggett
>            Priority: Major
>
> Life is too short to deal with exceptions like this one:
> java.lang.LinkageError: loader constraint violation: when resolving method 
> 'org.slf4j.ILoggerFactory 
> org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()' the class loader 
> org.apache.catalina.loader.ParallelWebappClassLoader @4bd217c of the current 
> class, org/slf4j/LoggerFactory, and the class loader java.net.URLClassLoader 
> @7907ec20 for the method's defining class, org/slf4j/impl/StaticLoggerBinder, 
> have different Class objects for the type org/slf4j/ILoggerFactory used in 
> the signature (org.slf4j.LoggerFactory is in unnamed module of loader 
> org.apache.catalina.loader.ParallelWebappClassLoader @4bd217c, parent loader 
> java.net.URLClassLoader @7907ec20; org.slf4j.impl.StaticLoggerBinder is in 
> unnamed module of loader java.net.URLClassLoader @7907ec20, parent loader 
> 'app')
> Remove slf4j and replace with the java default behaviour.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to