Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with ActiveMQ client: ClassNotFoundException org.apache.logging.log4j.spi.AbstractLoggerAdapter

I have a small ActiveMQ client that is supposed to just connect to the AMQ service, create a queue, and send out a message. I am getting the following error message:

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerAdapter
  at java.lang.ClassLoader.defineClassl(Native Method)
  ...

The following jars are on my classpath:

log4j-1.2-api-2.6.2.jar
log4j-core-2.6.2.jar
log4j-slf4j-impl-2.6.2.jar

activemq-broker-5.13.3.jar
activemq-client-5.13.3.jar
activemq-console-5.13.3.jar
activemq-jaas-5.13.3.jar
activemq-kahadb-store-5.13.3.jar
activemq-openwire-legacy-5.13.3.jar
activemq-protobuf-1.1.jar
activemq-spring-5.13.3.jar
activemq-web-5.13.3.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-jta_1.0.1B_spec-1.0.1.jar
hawtbuf-1.11.jar
jcl-over-slf4j-1.7.13.jar
slf4j-api-1.7.13.jar

If I take away the top three libraries I get the error Failed to load class “org.slf4j.impl.StaticLoggerBinder”

I've tried searching but I can't say that I've found anything that has worked so far.

like image 623
filpa Avatar asked Oct 14 '25 21:10

filpa


2 Answers

You need to add log4j-api-2.6.2.jar to your classpath.

like image 134
rgoers Avatar answered Oct 17 '25 10:10

rgoers


I had exactly the same error. I replaced org.apache.logging.log4j:log4j-slf4j-impl:2.12.1 to org.slf4j:slf4j-simple:2.0.0-alpha1. It helped me.

like image 21
ns16 Avatar answered Oct 17 '25 12:10

ns16



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!