'ActiveMQ crashes after upgrading to Log4j 2
I am facing issue while starting ActiveMQ 5.14.3 after upgrading from Log4j 1.2.17 to Log4j 2.17.1.
- Replaced
log4j-1.2.17
withlog4j-1.2-api-2.17.1.jar
,log4j-api-2.17.1.jar
,log4j-core-2.17.1.jar
atapache-activemq-5.14.3\lib\optional
- Have set system property
-Dlog4j1.compatibility=true
After these changes, when tried to restart ActiveMQ it crashes with an error : -
FINEST|7844/0|22-02-22 20:55:48|Caused by: java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger does not implement the requested interface org.apache.log4j.spi.AppenderAttachable
FINEST|7844/0|22-02-22 20:55:48| at io.fabric8.insight.log.log4j.Log4jLogQuery.reconnectAppender(Log4jLogQuery.java:115) ~[insight-log4j-1.2.0.Beta4.jar:1.2.0.Beta4]
FINEST|7844/0|22-02-22 20:55:48| at io.fabric8.insight.log.log4j.Log4jLogQuery.start(Log4jLogQuery.java:100) ~[insight-log4j-1.2.0.Beta4.jar:1.2.0.Beta4]
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_281]
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
FINEST|7844/0|22-02-22 20:55:48| at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_281]
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1700) ~[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1639) ~[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568) ~[spring-beans-4.1.9.RELEASE.jar:4.1.9.RELEASE]
FINEST|7844/0|22-02-22 20:55:48| ... 33 more
FINEST|7844/0|22-02-22 20:55:48|ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logQuery' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger does not implement the requested interface org.apache.log4j.spi.AppenderAttachable
FINEST|7844/0|22-02-22 20:55:48|java.lang.RuntimeException: Failed to execute start task. Reason: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logQuery' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger does not implement the requested interface org.apache.log4j.spi.AppenderAttachable
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:91)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at java.lang.reflect.Method.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
FINEST|7844/0|22-02-22 20:55:48| at org.apache.activemq.console.Main.main(Main.java:115)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at java.lang.reflect.Method.invoke(Unknown Source)
FINEST|7844/0|22-02-22 20:55:48| at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJVMMain.java:53)
FINEST|7844/0|22-02-22 20:55:48| at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.java:36)
FINEST|7844/0|22-02-22 20:55:48|Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logQuery' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger does not implement the requested interface org.apache.log4j.spi.AppenderAttachable
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
FINEST|7844/0|22-02-22 20:55:48| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
Solution 1:[1]
If you want to use Log4j 2 with ActiveMQ you'll need to wait for ActiveMQ 5.17.0 which will be released soon. See AMQ-7426 for more details.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |