It’s really that it requires log4j (or crashes) rather than (as 5.17.6 does) 
defaulting to NOP logging and allowing the application to configure it.

From: Jean-Baptiste Onofré <j...@nanthrax.net>
Sent: Wednesday, November 15, 2023 10:31 PM
To: nha...@absolute.com.invalid
Cc: users@activemq.apache.org
Subject: Re: activemq-all-5.18.3.jar depends on log4j2 but does not include it

Hi, Thanks for the report. I guess you mean shading ? Because it would say it's 
not really a problem to not ship log4j, simply to allow us to pick the version 
you want. If you want it in the uber jar (shaded), let me check. I will probably
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This email came from outside of Absolute. Do not click links or open 
attachments unless you recognize the sender and know the content is safe.
ZjQcmQRYFpfptBannerEnd

Hi,



Thanks for the report.

I guess you mean shading ? Because it would say it's not really a

problem to not ship log4j, simply to allow us to pick the version you

want.

If you want it in the uber jar (shaded), let me check.

I will probably a Jira and keep you posted.



Regards

JB



On Thu, Nov 16, 2023 at 12:47 AM Norman Hamer

<nha...@absolute.com.invalid<mailto:nha...@absolute.com.invalid>> wrote:

>

> TL;DR this is a regression vs 5.17.6

> It appears to me (code inspection) to be caused by commit e5970172 / AMQ-7426

>

> activemq-all-5.18.3.jar(as far as I can tell, erroneously) includes a 
> META-INF/services/org.slf4j.spi.SLF4JServiceProvider file specifying 
> org.apache.logging.slf4j.SLF4JServiceProvider

> (aka 
> logging-log4j2/log4j-slf4j2-impl/src/main/java/org/apache/logging/slf4j/SLF4JServiceProvider.java)
>  rather than allowing/requiring the application to configure it.

>

> This looks to me to be just be the default because 
> org.apache.logging:log4j-slf4j-impl is included, even though it's declared 
> optional.

>

> -------------

>

> Workarounds:

>

> Delete META-INF/services/org.slf4j.spi.SLF4JServiceProvider from 
> activemq-all-5.18.3.jar Downgrade to activemq-all-5.17.6.jar Include log4j2 
> in the classpath

>

> -------------

>

> Attempting to upgrade a project from 5.16.x, which does not otherwise include 
> log4j2, I dropped in 5.18.3 and see the following exceptions:

>

> Exception occurred: java.lang.ClassNotFoundException (to be caught at: 
> org.slf4j.LoggerFactory.bind(), line=208 
> bci=86)"thread=AlertClientSettingsProvider", 
> jdk.internal.loader.BuiltinClassLoader.loadClass(), line=581 bci=19

>

> AlertClientSettingsProvider[1] where

>   [1] jdk.internal.loader.BuiltinClassLoader.loadClass 
> (BuiltinClassLoader.java:581)

>   [2] jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass 
> (ClassLoaders.java:178)

>   [3] java.lang.ClassLoader.loadClass (ClassLoader.java:522)

>   [4] org.apache.logging.slf4j.SLF4JServiceProvider.initialize 
> (SLF4JServiceProvider.java:53)

>   [5] org.slf4j.LoggerFactory.bind (LoggerFactory.java:195)

>   [6] org.slf4j.LoggerFactory.performInitialization (LoggerFactory.java:182)

>   [7] org.slf4j.LoggerFactory.getProvider (LoggerFactory.java:490)

>   [8] org.slf4j.LoggerFactory.getILoggerFactory (LoggerFactory.java:476)

>   [9] org.slf4j.LoggerFactory.getLogger (LoggerFactory.java:425)

>   [10] org.slf4j.LoggerFactory.getLogger (LoggerFactory.java:451)

>   [11] org.apache.activemq.broker.BrokerService.<clinit> 
> (BrokerService.java:139) <application stack snipped>

>

> AlertClientSettingsProvider[1] locals

> Method arguments:

> cn = "org.apache.logging.log4j.Logger"

> resolve = false

>

> causing:

>

> Exception occurred: java.lang.NoClassDefFoundError (to be caught at: 
> java.util.concurrent.FutureTask.runAndReset(), line=307 
> bci=55)"thread=AlertClientSettingsProvider", 
> org.slf4j.LoggerFactory.getProvider(), line=492 bci=33

>

> AlertClientSettingsProvider[1] where

>   [1] org.slf4j.LoggerFactory.getProvider (LoggerFactory.java:492)

>   [2] org.slf4j.LoggerFactory.getILoggerFactory (LoggerFactory.java:476)

>   [3] org.slf4j.LoggerFactory.getLogger (LoggerFactory.java:425)

>   [4] org.slf4j.LoggerFactory.getLogger (LoggerFactory.java:451)

>   [5] org.apache.activemq.broker.BrokerService.<clinit> 
> (BrokerService.java:139) <application stack snipped>

>

> (Instantiation of BrokerService fails and the application goes away)

>

> -------------

Reply via email to