风暴导致Ignite log4j上的依赖项冲突

时间:2018-08-14 11:42:58

标签: maven dependencies log4j apache-storm apache-storm-topology

我尝试在Storm集群上运行Storm拓扑拓扑jar是由提供的创建的。在拓扑螺栓内部,我想从MyIgniteCache模块读取数据,但出现以下错误。我认为依赖项(:/usr/hdp/2.6.0.3-8/storm/lib/log4j-slf4j-impl-2.8.jar:/usr/hdp/2.6.0.3-8/storm/lib/log4j-core- 2.8.jar:log4j)的风暴核心导致与ignite-log4j发生冲突。

  

ava.lang.IncompatibleClassChangeError:实现类           在java.lang.ClassLoader.defineClass1(本机方法)〜[?:1.8.0_112]           在java.lang.ClassLoader.defineClass(ClassLoader.java:763)〜[?:1.8.0_112]           在java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)〜[?:1.8.0_112]           在java.net.URLClassLoader.defineClass(URLClassLoader.java:467)〜[?:1.8.0_112]           在java.net.URLClassLoader.access $ 100(URLClassLoader.java:73)〜[?:1.8.0_112]           在java.net.URLClassLoader $ 1.run(URLClassLoader.java:368)〜[?:1.8.0_112]           在java.net.URLClassLoader $ 1.run(URLClassLoader.java:362)〜[?:1.8.0_112]           在java.security.AccessController.doPrivileged(本机方法)〜[?:1.8.0_112]           在java.net.URLClassLoader.findClass(URLClassLoader.java:361)〜[?:1.8.0_112]           在java.lang.ClassLoader.loadClass(ClassLoader.java:424)〜[?:1.8.0_112]           在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:331)〜[?:1.8.0_112]           在java.lang.ClassLoader.loadClass(ClassLoader.java:357)〜[?:1.8.0_112]           在java.lang.Class.forName0(本机方法)〜[?:1.8.0_112]           在java.lang.Class.forName(Class.java:264)〜[?:1.8.0_112]           在org.apache.ignite.internal.util.IgniteUtils.addLog4jNoOpLogger(IgniteUtils.java:8366)〜[stormjar.jar :?]           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:930)〜[stormjar.jar :?]           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854)〜[stormjar.jar :?]           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724)〜[stormjar.jar :?]           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693)〜[stormjar.jar :?]           在org.apache.ignite.Ignition.start(Ignition.java:352)〜[stormjar.jar:?]

我的风暴拓扑模块的依赖树如下所示

<p>
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mytopology-enrichment 1.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ mytopology-enrichment---
[INFO] com.my.storm:mytopology-enrichment:jar:1.1
[INFO] +- org.apache.storm:flux-core:jar:1.1.0:compile
[INFO] |  \- commons-cli:commons-cli:jar:1.2:compile
[INFO] +- org.apache.storm:flux-wrappers:jar:1.1.0:compile
[INFO] |  +- org.apache.storm:multilang-javascript:jar:1.1.0:compile
[INFO] |  +- org.apache.storm:multilang-ruby:jar:1.1.0:compile
[INFO] |  \- org.apache.storm:multilang-python:jar:1.1.0:compile
[INFO] +- com.my.storm:my-common:jar:1.1:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- com.my.storm:mytopology-preprocessing:jar:1.1:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] +- org.apache.storm:storm-core:jar:1.1.0:compile
[INFO] |  +- com.esotericsoftware:kryo:jar:3.0.3:compile
[INFO] |  |  +- com.esotericsoftware:reflectasm:jar:1.10.1:compile
[INFO] |  |  |  \- org.ow2.asm:asm:jar:5.0.3:compile
[INFO] |  |  +- com.esotericsoftware:minlog:jar:1.3.0:compile
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:compile
[INFO] |  +- org.clojure:clojure:jar:1.7.0:compile
[INFO] |  +- ring-cors:ring-cors:jar:0.1.5:compile
[INFO] |  +- com.lmax:disruptor:jar:3.3.2:compile
[INFO] |  +- org.apache.logging.log4j:log4j-api:jar:2.8:compile
[INFO] |  +- org.apache.logging.log4j:log4j-core:jar:2.8:compile
[INFO] |  +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.8:compile
[INFO] |  +- org.slf4j:log4j-over-slf4j:jar:1.6.6:compile
[INFO] |  +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.apache.storm:storm-kafka-client:jar:1.1.0:compile
[INFO] +- org.apache.kafka:kafka_2.10:jar:0.10.2.0:compile
[INFO] |  +- net.sf.jopt-simple:jopt-simple:jar:5.0.3:compile
[INFO] |  +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] |  +- org.scala-lang:scala-library:jar:2.10.6:compile
[INFO] |  \- com.101tec:zkclient:jar:0.10:compile
[INFO] +- org.apache.kafka:kafka-clients:jar:0.10.2.0:compile
[INFO] |  +- net.jpountz.lz4:lz4:jar:1.3.0:compile
[INFO] |  \- org.xerial.snappy:snappy-java:jar:1.1.2.6:compile
[INFO] +- junit:junit:jar:4.12:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- joda-time:joda-time:jar:2.10:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- com.my.ignite:my-config-cache:jar:1.1:compile
[INFO] |  +- org.apache.ignite:ignite-core:jar:2.5.0:compile
[INFO] |  |  +- javax.cache:cache-api:jar:1.0.0:compile
[INFO] |  |  +- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  |  \- org.gridgain:ignite-shmem:jar:1.0.0:compile
[INFO] |  +- org.apache.ignite:ignite-spring:jar:2.5.0:compile
[INFO] |  |  +- org.apache.ignite:ignite-indexing:jar:2.5.0:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-core:jar:5.5.2:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-analyzers-common:jar:5.5.2:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-queryparser:jar:5.5.2:compile
[INFO] |  |  |  |  +- org.apache.lucene:lucene-queries:jar:5.5.2:compile
[INFO] |  |  |  |  \- org.apache.lucene:lucene-sandbox:jar:5.5.2:compile
[INFO] |  |  |  \- com.h2database:h2:jar:1.4.195:compile
[INFO] |  |  +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:4.3.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.apache.ignite:ignite-log4j:jar:2.5.0:compile
[INFO] |  |  \- log4j:log4j:jar:1.2.17:compile
[INFO] |  \- postgresql:postgresql:jar:9.1-901.jdbc4:compile
[INFO] +- com.my.elastic:my-elasticsearch:jar:1.1:compile
[INFO] |  +- org.elasticsearch:elasticsearch-storm:jar:5.4.1:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |     \- commons-codec:commons-codec:jar:1.2:compile
[INFO] \- com.google.code.gson:gson:jar:2.8.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.351 s
[INFO] Finished at: 2018-08-14T13:37:44+03:00
[INFO] Final Memory: 16M/294M
</p>

这是我的配置缓存的依赖树

apache ignite cache module dependency tree
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my-config-cache 1.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ my-config-cache ---
[INFO] com.my.ignite:my-config-cache:jar:1.1
[INFO] +- org.apache.ignite:ignite-core:jar:2.5.0:compile
[INFO] |  +- javax.cache:cache-api:jar:1.0.0:compile
[INFO] |  +- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  \- org.gridgain:ignite-shmem:jar:1.0.0:compile
[INFO] +- org.apache.ignite:ignite-spring:jar:2.5.0:compile
[INFO] |  +- org.apache.ignite:ignite-indexing:jar:2.5.0:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.11:compile
[INFO] |  |  +- org.apache.lucene:lucene-core:jar:5.5.2:compile
[INFO] |  |  +- org.apache.lucene:lucene-analyzers-common:jar:5.5.2:compile
[INFO] |  |  +- org.apache.lucene:lucene-queryparser:jar:5.5.2:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-queries:jar:5.5.2:compile
[INFO] |  |  |  \- org.apache.lucene:lucene-sandbox:jar:5.5.2:compile
[INFO] |  |  \- com.h2database:h2:jar:1.4.195:compile
[INFO] |  +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:4.3.7.RELEASE:compile
[INFO] +- org.apache.ignite:ignite-log4j:jar:2.5.0:compile
[INFO] |  \- log4j:log4j:jar:1.2.17:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.0:compile
[INFO] +- junit:junit:jar:4.12:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- postgresql:postgresql:jar:9.1-901.jdbc4:compile
[INFO] \- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.070 s
[INFO] Finished at: 2018-08-14T13:40:24+03:00
[INFO] Final Memory: 
尽管存在这些依赖性,但在IDE

上运行拓扑和myconfigcache模块时,我又收到了严重警告。

Strom topoloji module runtime

log4j:WARN No appenders could be found for logger (org.elasticsearch.storm.EsBolt).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

bla blaa blaa
........
...........


Aug 14, 2018 1:36:17 PM java.util.logging.LogManager$RootLogger log
SEVERE: Failed to resolve default logging config file: config/java.util.logging.properties
[13:36:17]    __________  ________________ 
[13:36:17]   /  _/ ___/ |/ /  _/_  __/ __/ 
[13:36:17]  _/ // (7 7    // /  / / / _/   
[13:36:17] /___/\___/_/|_/___/ /_/ /___/  
[13:36:17] 
[13:36:17] ver. 2.5.0#20180523-sha1:86e110c7

blaaa blaa

那么我该如何处理除Storm log4j依赖关系之外的拓扑?

1 个答案:

答案 0 :(得分:1)

Storm使用Log4j 2进行日志记录,因此,如果要转而使用ignite-log4j2,则ignite-log4j看起来类似于Log4j1。我也希望您可以使用ignite-slf4j并具有工作。