[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-3737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17044654#comment-17044654
 ] 

Patrick D. Hunt commented on ZOOKEEPER-3737:
--------------------------------------------

According to this:
https://logging.apache.org/log4j/2.x/manual/jmx.html
in log4j2 "JMX support is enabled by default"

As such the registerLog4jMBeans method should not be called when log4j2 is 
being used. Perhaps we can check whether HierarchyDynamicMBean is available and 
not call the method - ie add another check to isLog4jJmxEnabled...

> Unable to eliminate log4j1 transitive dependency
> ------------------------------------------------
>
>                 Key: ZOOKEEPER-3737
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3737
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: jmx, server
>    Affects Versions: 3.4.14, 3.5.7
>            Reporter: Christopher Tubbs
>            Priority: Major
>
> Apache Accumulo is trying to switch to using log4j2 only. However, this seems 
> impossible, because ZooKeeper has a hard-coded dependency on log4j 1.2 for 
> some sort of jmx thing. The following is the error and stack trace I get 
> whenever I remove log4j 1.2 from the class path and try to run a test 
> instance of ZooKeeper as part of Accumulo's build test suite.
> {code}
> 2020-02-24T20:10:03,682 [jmx.ManagedUtil] ERROR: Problems while registering 
> log4j jmx beans!
> java.lang.ClassNotFoundException: org.apache.log4j.jmx.HierarchyDynamicMBean
>       at 
> jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) 
> ~[?:?]
>       at 
> jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>  ~[?:?]
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
>       at java.lang.Class.forName0(Native Method) ~[?:?]
>       at java.lang.Class.forName(Class.java:315) ~[?:?]
>       at 
> org.apache.zookeeper.jmx.ManagedUtil.registerLog4jMBeans(ManagedUtil.java:72) 
> ~[zookeeper-3.5.7.jar:3.5.7]
>       at 
> org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:94)
>  ~[zookeeper-3.5.7.jar:3.5.7]
>       at 
> org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
>  ~[zookeeper-3.5.7.jar:3.5.7]
>       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:?]
>       at 
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  ~[?:?]
>       at 
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:?]
>       at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
>       at org.apache.accumulo.start.Main.lambda$execMainClass$1(Main.java:167) 
> ~[accumulo-start-2.1.0-SNAPSHOT.jar:2.1.0-SNAPSHOT]
>       at java.lang.Thread.run(Thread.java:834) [?:?]
> {code}
> I know previous work has been done on ZOOKEEPER-850 and ZOOKEEPER-1371 to 
> eliminate the use of log4j in the source, but this work does not appear to be 
> complete, since it is still required at runtime (at least, for the server... 
> but maybe for the client too... it's hard to tell from the way Accumulo runs 
> its test suite, and I'm not super familiar with ZK internals).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to