You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Wolf, Chris (ELS-CON)" <c....@elsevier.com> on 2020/02/11 15:39:27 UTC
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" <da...@gmail.com> 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) <c....@elsevier.com>
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:
> <dependency>
> <groupId>org.apache.solr</groupId>
> <artifactId>solr-core</artifactId>
> <version>7.5.0</version>
> <exclusions>
> <exclusion>
> <artifactId>org.apache.logging.log4j</artifactId>
> <groupId>log4j-slf4j-impl</groupId>
> </exclusion>
> </exclusions>
> </dependency>
>
> 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?
>
>
>
>
>
>