Er, sorry, I'd gone back and forth looking at commits a few times. I meant 
030d1b5 / AMQ-9223 which is only on 5.18

-----Original Message-----
From: Norman Hamer 
Sent: Wednesday, November 15, 2023 3:48 PM
To: users@activemq.apache.org
Subject: activemq-all-5.18.3.jar depends on log4j2 but does not include it

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