Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
(I found this stuck in my outbox, sorry for the delayed response) Hi, Thank you, I finally was able to configure maven to exclude that logging implementation. But now I'm having an issue building a Spring-Boot executable WAR with embedded Tomcat, for some reason, when I "spring-boot:run" it, it seems to use embedded Jetty rather then embedded Tomcat. I *think* it's because "solr-core" has transitive dependency on jetty jars. I will file a Jira when I get to the bottom of this as well. Thanks for getting back to me. -Chris On 1/16/20, 10:49 PM, "David Smiley" wrote: *** External email: use caution *** Ultimately if you deduce the problem, file a JIRA issue and share it with me; I will look into it. I care about this matter too; I hate having to exclude logging dependencies on the consuming end. ~ David Smiley Apache Lucene/Solr Search Developer http://www.linkedin.com/in/davidwsmiley On Wed, Jan 15, 2020 at 9:03 PM Wolf, Chris (ELS-CON) wrote: > I am having several issues due to the slf4j implementation dependency > “log4j-slf4j-impl” being declared as a dependency of solr-core:7.5.0. The > first issue observed when starting the app is this: > > SLF4J: Class path contains multiple SLF4J bindings. > SLF4J: Found binding in > [jar:file:/Users/ma-wolf2/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.7/log4j-slf4j-impl-2.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: Found binding in > [jar:file:/Users/ma-wolf2/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.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 > [org.apache.logging.slf4j.Log4jLoggerFactory] > > I first got wind that this might not be just myself from this thread: > > https://lucene.472066.n3.nabble.com/log4j-slf4j-impl-dependency-in-solr-core-td4449635.html#a4449891 > > > * If there are any users that integrate solr-core into their own code, > it's currently a bit of a land-mine situation to change logging > implementations. If there's a way we can include log4j jars at build > time, but remove the log4j dependency on the published solr-core > artifact, that might work well. We should do our best to make it so > people can use EmbeddedSolrServer without log4j jars. > > There are two dimensions to this dependency problem: > > * Building a war file (this runs with a warning) > * Building a spring-boot executable JAR with embedded servlet > container (doesn’t run) > > When building a WAR and deploying, I get the “multiple SLF4J bindings” > warning, but the app works. However, I want the convenience of a > spring-boot executable JAR with embedded servlet container, but in that > case, I get that warning followed by a fatal NoClassDefFoundError/ > ClassNotFoundException – which is a show-stopper. If I hack the built > spring-boot FAT jar and remove “log4j-slf4j-impl.jar” then the app works. > > For the WAR build, the proper version of log4j-slf4j-impl.jar was included > – 2.11.0, but,for some reason when building the spring-boot fat (uber) jar, > it was building with log4j-slf4j-impl:2.7 so of course it will croak. > > There are several issues: > > 1. I don’t want log4j-slf4j-impl at all > 2. Somehow the version of “log4j-slf4j-impl” being used for the build > is 2.7 rather then the expected 2.11.0 > 3. Due to the version issue, the app croaks with > ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil > > For issue #1, I tried: > > org.apache.solr > solr-core > 7.5.0 > > > org.apache.logging.log4j > log4j-slf4j-impl > > > > > All to no avail, as that dependency ends up in the packaged build - for > WAR, it’s version 2.11.0, so even though it’s a bad build, the app runs, > but for building a spring-boot executable JAR with embedded webserver, for > some reason, it switches log4j-slf4j-impl from version 2.11.0 to 2,7 > (2.11.0 works, but should not even be there) > > I also tried this: > > https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/exclude-dependency.html > > …that didn’t work either. > > I’m thinking that solr-core should have added a classifier of “provided” > for “log4j-slf4j-impl”, but that’s conjecture of a possible solution going > forward, but does anyone know how I can exclude “log4j-slf4j-impl” from a > spring-boot build? > > > > > >
Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
(sorry for bad formatting Outlook-for-Mac doesn't support Internet quoting) Thanks Mark, I did that until I finally was able to exclude it altogether. -Chris On 1/17/20, 10:20 AM, "Mark H. Wood" wrote: For the version problem, I would try adding something like: org.apache.logging.log4j log4j-slf4j-impl 2.11.0 to pin down the version no matter what is pulling it in. Not ideal, since you want to be rid of this dependency altogether, but at least it may allow the spring-boot artifact to run, until the other problem is sorted.
Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
On Thu, Jan 16, 2020 at 03:13:17PM +, Wolf, Chris (ELS-CON) wrote: > --- original message --- > It looks to me as though solr-core is not the only artifact with that > dependency. The first thing I would do is examine the output of 'mvn > dependency:tree' to see what has dragged log4j-slf4j-impl in even when > it is excluded from solr-core. > --- end of original message --- > > Hi, that's the first thing I did and *only* solr-core is pulling in > log4j-slf4j-impl, but there is more weirdness to this. When I build as a WAR > project, then version 2.11.0 of in log4j-slf4j-impl is pulled in which > results in "multiple implementations" warning and is non-fatal. > > However, when building as a spring-boot executable jar, for some reason, it > pulls in version 2.7 rather then 2.11.0 resulting in fatal > "ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil" For the version problem, I would try adding something like: org.apache.logging.log4j log4j-slf4j-impl 2.11.0 to pin down the version no matter what is pulling it in. Not ideal, since you want to be rid of this dependency altogether, but at least it may allow the spring-boot artifact to run, until the other problem is sorted. -- Mark H. Wood Lead Technology Analyst University Library Indiana University - Purdue University Indianapolis 755 W. Michigan Street Indianapolis, IN 46202 317-274-0749 www.ulib.iupui.edu signature.asc Description: PGP signature
Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
Ultimately if you deduce the problem, file a JIRA issue and share it with me; I will look into it. I care about this matter too; I hate having to exclude logging dependencies on the consuming end. ~ David Smiley Apache Lucene/Solr Search Developer http://www.linkedin.com/in/davidwsmiley On Wed, Jan 15, 2020 at 9:03 PM Wolf, Chris (ELS-CON) wrote: > I am having several issues due to the slf4j implementation dependency > “log4j-slf4j-impl” being declared as a dependency of solr-core:7.5.0. The > first issue observed when starting the app is this: > > SLF4J: Class path contains multiple SLF4J bindings. > SLF4J: Found binding in > [jar:file:/Users/ma-wolf2/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.7/log4j-slf4j-impl-2.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: Found binding in > [jar:file:/Users/ma-wolf2/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.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 > [org.apache.logging.slf4j.Log4jLoggerFactory] > > I first got wind that this might not be just myself from this thread: > > https://lucene.472066.n3.nabble.com/log4j-slf4j-impl-dependency-in-solr-core-td4449635.html#a4449891 > > > * If there are any users that integrate solr-core into their own code, > it's currently a bit of a land-mine situation to change logging > implementations. If there's a way we can include log4j jars at build > time, but remove the log4j dependency on the published solr-core > artifact, that might work well. We should do our best to make it so > people can use EmbeddedSolrServer without log4j jars. > > There are two dimensions to this dependency problem: > > * Building a war file (this runs with a warning) > * Building a spring-boot executable JAR with embedded servlet > container (doesn’t run) > > When building a WAR and deploying, I get the “multiple SLF4J bindings” > warning, but the app works. However, I want the convenience of a > spring-boot executable JAR with embedded servlet container, but in that > case, I get that warning followed by a fatal NoClassDefFoundError/ > ClassNotFoundException – which is a show-stopper. If I hack the built > spring-boot FAT jar and remove “log4j-slf4j-impl.jar” then the app works. > > For the WAR build, the proper version of log4j-slf4j-impl.jar was included > – 2.11.0, but,for some reason when building the spring-boot fat (uber) jar, > it was building with log4j-slf4j-impl:2.7 so of course it will croak. > > There are several issues: > > 1. I don’t want log4j-slf4j-impl at all > 2. Somehow the version of “log4j-slf4j-impl” being used for the build > is 2.7 rather then the expected 2.11.0 > 3. Due to the version issue, the app croaks with > ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil > > For issue #1, I tried: > > org.apache.solr > solr-core > 7.5.0 > > > org.apache.logging.log4j > log4j-slf4j-impl > > > > > All to no avail, as that dependency ends up in the packaged build - for > WAR, it’s version 2.11.0, so even though it’s a bad build, the app runs, > but for building a spring-boot executable JAR with embedded webserver, for > some reason, it switches log4j-slf4j-impl from version 2.11.0 to 2,7 > (2.11.0 works, but should not even be there) > > I also tried this: > > https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/exclude-dependency.html > > …that didn’t work either. > > I’m thinking that solr-core should have added a classifier of “provided” > for “log4j-slf4j-impl”, but that’s conjecture of a possible solution going > forward, but does anyone know how I can exclude “log4j-slf4j-impl” from a > spring-boot build? > > > > > >
Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
--- original message --- It looks to me as though solr-core is not the only artifact with that dependency. The first thing I would do is examine the output of 'mvn dependency:tree' to see what has dragged log4j-slf4j-impl in even when it is excluded from solr-core. --- end of original message --- Hi, that's the first thing I did and *only* solr-core is pulling in log4j-slf4j-impl, but there is more weirdness to this. When I build as a WAR project, then version 2.11.0 of in log4j-slf4j-impl is pulled in which results in "multiple implementations" warning and is non-fatal. However, when building as a spring-boot executable jar, for some reason, it pulls in version 2.7 rather then 2.11.0 resulting in fatal "ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil" Thanks. Here is the dependency tree: com.elsevier::jar:1.1.7 +- org.springframework.boot:spring-boot-starter-web:jar:1.5.6.RELEASE:compile | +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:compile | | +- org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:compile | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.6.RELEASE:compile | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.6.RELEASE:compile | | +- org.springframework:spring-core:jar:4.3.10.RELEASE:compile | | \- org.yaml:snakeyaml:jar:1.17:runtime | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.6.RELEASE:compile | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.16:compile | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.16:compile | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.16:compile | +- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile | | +- javax.validation:validation-api:jar:1.1.0.Final:compile | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile | | \- com.fasterxml:classmate:jar:1.3.3:compile | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile | +- org.springframework:spring-web:jar:4.3.10.RELEASE:compile | | +- org.springframework:spring-aop:jar:4.3.10.RELEASE:compile | | +- org.springframework:spring-beans:jar:4.3.10.RELEASE:compile | | \- org.springframework:spring-context:jar:4.3.10.RELEASE:compile | \- org.springframework:spring-webmvc:jar:4.3.10.RELEASE:compile | \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile +- cglib:cglib-nodep:jar:3.0:runtime +- org.apache.commons:commons-lang3:jar:3.1:compile +- org.jdom:jdom2:jar:2.0.6:compile +- com.example.somelibjar:jar:1.1.9:compile | +- org.apache.lucene:lucene-core:jar:7.5.0:compile | +- com.healthline:qpe:jar:1.1.5:compile | | +- org.springframework:spring-context-support:jar:4.3.10.RELEASE:compile | | +- org.springframework:spring-jdbc:jar:4.3.10.RELEASE:compile | | | \- org.springframework:spring-tx:jar:4.3.10.RELEASE:compile | | \- org.apache.logging.log4j:log4j-core:jar:2.7:compile | +- com.exampe:somelib2:jar:1.1.4:compile | | +- org.apache.solr:solr-core:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-analyzers-common:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-analyzers-kuromoji:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-analyzers-nori:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-analyzers-phonetic:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-backward-codecs:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-classification:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-codecs:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-expressions:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-grouping:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-highlighter:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-join:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-memory:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-misc:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-queries:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-queryparser:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-sandbox:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-spatial-extras:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-spatial3d:jar:7.5.0:compile | | | +- org.apache.lucene:lucene-suggest:jar:7.5.0:compile | | | +- com.carrotsearch:hppc:jar:0.8.1:compile | | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.9:compile | | | +- com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile | | | +- com.google.guava:guava:jar:14.0.1:compile | | | +- com.google.protobuf:protobuf-java:jar:3.1.0:compile | | | +- com.lmax:disruptor:jar:3.4.0:compile | | | +- com.tdunning:t-digest:jar:3.1:compile | | | +- commons-codec:commons-codec:jar:1.10:compile | | | +-
Re: Dependency log4j-slf4j-impl for solr-core:7.5.0 causing a number of build problems
On Thu, Jan 16, 2020 at 02:03:06AM +, Wolf, Chris (ELS-CON) wrote: [snip] > There are several issues: > > 1. I don’t want log4j-slf4j-impl at all > 2. Somehow the version of “log4j-slf4j-impl” being used for the build is > 2.7 rather then the expected 2.11.0 > 3. Due to the version issue, the app croaks with ClassNotFoundException: > org.apache.logging.log4j.util.ReflectionUtil > > For issue #1, I tried: > > org.apache.solr > solr-core > 7.5.0 > > > org.apache.logging.log4j > log4j-slf4j-impl > > > > > All to no avail, as that dependency ends up in the packaged build - for WAR, > it’s version 2.11.0, so even though it’s a bad build, the app runs, but for > building a spring-boot executable JAR with embedded webserver, for some > reason, it switches log4j-slf4j-impl from version 2.11.0 to 2,7 (2.11.0 > works, but should not even be there) > > I also tried this: > https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/exclude-dependency.html > > …that didn’t work either. > > I’m thinking that solr-core should have added a classifier of “provided” for > “log4j-slf4j-impl”, but that’s conjecture of a possible solution going > forward, but does anyone know how I can exclude “log4j-slf4j-impl” from a > spring-boot build? It looks to me as though solr-core is not the only artifact with that dependency. The first thing I would do is examine the output of 'mvn dependency:tree' to see what has dragged log4j-slf4j-impl in even when it is excluded from solr-core. -- Mark H. Wood Lead Technology Analyst University Library Indiana University - Purdue University Indianapolis 755 W. Michigan Street Indianapolis, IN 46202 317-274-0749 www.ulib.iupui.edu signature.asc Description: PGP signature