elasticsearch,log4j,apache-storm,Maven,elasticsearch,Log4j,Apache Storm" /> elasticsearch,log4j,apache-storm,Maven,elasticsearch,Log4j,Apache Storm" />

Maven log4j与Apache Storm 1.0.1和Elasticsearch 5.3.1冲突

Maven log4j与Apache Storm 1.0.1和Elasticsearch 5.3.1冲突,maven,elasticsearch,log4j,apache-storm,Maven,elasticsearch,Log4j,Apache Storm,我和maven有些问题。到目前为止找不到任何解决方案。尝试使用shade插件,但不确定是否正确排除 Apache Storm使用log4j 2.1版本。但弹性搜索至少需要2.7。有什么建议吗 多谢各位 pom.xml文件的一部分: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId>

我和maven有些问题。到目前为止找不到任何解决方案。尝试使用shade插件,但不确定是否正确排除

Apache Storm使用log4j 2.1版本。但弹性搜索至少需要2.7。有什么建议吗

多谢各位

pom.xml文件的一部分:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <createDependencyReducedPom>true</createDependencyReducedPom>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                            <exclude>org/slf4j/**</exclude>
                            <exclude>log4j:log4j:[0.0,2.7)</exclude>
                            <exclude>org.apache.log4j:*:[0.0,2.7)</exclude>
                        </excludes>
                    </filter>
                </filters>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <shadedArtifactAttached>true</shadedArtifactAttached>
                        <shadedClassifierName>shaded</shadedClassifierName> <!-- Any name that makes sense -->
                        <transformers>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.boildata.gendustry.storm.topology.TridentHBaseMapTopology</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.7</version>
        <!--<scope>provided</scope>-->
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.7</version>
        <!--<scope>provided</scope>-->
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-to-slf4j</artifactId>
        <version>2.7</version>
        <!--<scope>provided</scope>-->
    </dependency>
<!-- Storm Dependencies -->
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>1.0.1.2.5.0.0-1245</version>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
<!-- Elasticsearch Dependency -->
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>5.3.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-1.2-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>transport</artifactId>
        <version>5.3.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-1.2-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

org.apache.maven.plugins
maven阴影插件
2.3
真的
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
org/slf4j/**
log4j:log4j:[0.0,2.7)
org.apache.log4j::[0.0,2.7)
包裹
阴凉处
真的
遮住的
com.boildata.gendustry.storm.topology.TridentHBaseMapTopology
org.apache.logging.log4j
log4j-slf4j-impl
2.7
org.apache.logging.log4j
log4j型芯
2.7
org.apache.logging.log4j
log4japi
2.7
org.apache.logging.log4j
log4j-to-slf4j
2.7
org.apache.storm
风暴核心
1.0.1.2.5.0.0-1245
假如
org.slf4j
log4j-over-slf4j
org.slf4j
slf4j-log4j12
org.slf4j
slf4j api
org.apache.logging.log4j
log4j型芯
org.apache.logging.log4j
log4japi
org.apache.logging.log4j
log4j-to-slf4j
org.apache.logging.log4j
log4j-slf4j-impl
org.elasticsearch
弹性搜索
5.3.1
org.apache.logging.log4j
log4japi
org.apache.logging.log4j
log4j型芯
org.apache.logging.log4j
log4j-1.2-api
log4j
log4j
org.elasticsearch.client
运输
5.3.1
org.apache.logging.log4j
log4japi
org.apache.logging.log4j
log4j型芯
org.apache.logging.log4j
log4j-1.2-api
log4j
log4j

如果我使用log4j:2.7拓扑,则不提交..给出验证:

[root@master ~]# storm jar gendustry-storm-trident-1.0-SNAPSHOT-shaded.jar com.boildata.gendustry.storm.topology.TridentHBaseMapTopology remote Running: /usr/jdk64/jdk1.8.0_60/bin/java -server -Ddaemon.name= -Dstorm.options= -Dstorm.home=/usr/hdp/2.5.0.0-1245/storm -Dstorm.log.dir=/var/log/storm -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dstorm.conf.file= -cp /usr/hdp/2.5.0.0-1245/storm/lib/log4j-over-slf4j-1.6.6.jar:/usr/hdp/2.5.0.0-1245/storm/lib/log4j-core-2.1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/minlog-1.3.0.jar:/usr/hdp/2.5.0.0-1245/storm/lib/zookeeper.jar:/usr/hdp/2.5.0.0-1245/storm/lib/storm-rename-hack-1.0.1.2.5.0.0-1245.jar:/usr/hdp/2.5.0.0-1245/storm/lib/clojure-1.7.0.jar:/usr/hdp/2.5.0.0-1245/storm/lib/ambari-metrics-storm-sink.jar:/usr/hdp/2.5.0.0-1245/storm/lib/servlet-api-2.5.jar:/usr/hdp/2.5.0.0-1245/storm/lib/slf4j-api-1.7.7.jar:/usr/hdp/2.5.0.0-1245/storm/lib/objenesis-2.1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/ring-cors-0.1.5.jar:/usr/hdp/2.5.0.0-1245/storm/lib/storm-core-1.0.1.2.5.0.0-1245.jar:/usr/hdp/2.5.0.0-1245/storm/lib/disruptor-3.3.2.jar:/usr/hdp/2.5.0.0-1245/storm/lib/kryo-3.0.3.jar:/usr/hdp/2.5.0.0-1245/storm/lib/log4j-slf4j-impl-2.1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/reflectasm-1.10.1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/asm-5.0.3.jar:/usr/hdp/2.5.0.0-1245/storm/lib/log4j-api-2.1.jar org.apache.storm.daemon.ClientJarTransformerRunner org.apache.storm.hack.StormShadeTransformer gendustry-storm-trident-1.0-SNAPSHOT-shaded.jar /tmp/7e59eb582bde11e79d2e00505693135a.jar Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.logging.log4j.core.lookup.MapLookup.newMap(I)Ljava/util/HashMap; from class org.apache.logging.log4j.core.lookup.MainMapLookup at org.apache.logging.log4j.core.lookup.MainMapLookup.(MainMapLookup.java:37) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.apache.logging.log4j.core.util.ReflectionUtil.instantiate(ReflectionUtil.java:185) at org.apache.logging.log4j.core.lookup.Interpolator.(Interpolator.java:65) at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:346) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420) [root@master~]#storm jar gendustry-storm-trident-1.0-SNAPSHOT-shade.jar com.boildata.gendustry.storm.topology.tridentHBasamptopology远程 Running:/usr/jdk64/jdk1.8.060/bin/java-server-Ddaemon.name=-Dstorm.options=-Dstorm.home=/usr/hdp/2.5.0.0-1245/storm-Dstorm.log.dir=/var/log/storm-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib-Dstorm.conf.file=-cp/usr/hdp/2.5.0.0-1245/storm/lib/log4j-over-slf4j-1.6:/usr/hdr.jar/2/2.0/hdr-jar/1.0.0.jar:/usr/hdp/2.5.0-1245.5.0-1245.5.0-1245.0.0-1245/5.0.0-1245/风暴/1.5.5.5.5.0.0/2.5.0.0-2.0.0-2.0.0-1.0.0.1.jar/jar:/usr/usr/usr/hdp/2/2.5.5.5.5.0-5.0-5.0-5.0-1245.0-1245.0-1245.0-1245.0-5.0-1245.0-5.0-1245.0-5.0-5.0-5.0-5.0.0-1245.0.0-1245.0-5.0-5.0-5.0.0-1245.0-5.0-5.0-5.0-jar.5.jar:/usr/hdp/2.5.0.0-1245/1.7.7.7.jar:/usr/hdp/2.5.0.0-1245/风暴/lib/lib/obJeJeness-2.1.1.1.jar:/usr///usr/hdp/2.5.5.0-1.0-1.1.1.1.1.1.1.1/风暴/风暴/风暴/风暴/风暴/风暴/风暴/风暴/风暴/风暴-核心-核心-1.0.1.1.1.1.2.2.2.5.5.5.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0-1245-1245-1245-1245-1 jar:/usr/hdp/2.5.0.0-1245/storm/lib/log4j-slf4j-impl-2。1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/reflectasm-1.10.1.jar:/usr/hdp/2.5.0.0-1245/storm/lib/asm-5.0.3.jar:/usr/hdp/2.5.0.0-1245/storm/lib/log4j-api-2.1.jar org.apache.storm.jar.daemon.jar.clientjar.transformerrunner.org.apache.storm.storm.hack.storm.hard.transformer.stry-gendent-1.0-1.0-SNAPSHOT-SNAPSHOT.jar/1357e579e059eb9a/1357e599a 线程“main”java.lang.IllegalAccessError中出现异常:试图从类org.apache.logging.log4j.core.lookup.MapLookup.newMap(I)Ljava/util/HashMap;访问org.apache.logging.log4j.core.lookup.MainMapLookup方法 位于org.apache.logging.log4j.core.lookup.mainmapplookup。(mainmapplookup.java:37) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 位于java.lang.reflect.Constructor.newInstance(Constructor.java:422) 位于org.apache.logging.log4j.core.util.ReflectionUtil.instantiate(ReflectionUtil.java:185) 位于org.apache.logging.log4j.core.lookup.Interpolator.(Interpolator.java:65) 在org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration)上。 2017-04-27 20:16:44.599 o.a.s.util [ERROR] Async loop died! java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.debug(Ljava/lang/String;Ljava/lang/Object;)V at org.elasticsearch.threadpool.ThreadPool.(ThreadPool.java:203) ~[stormjar.jar:?] at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:129) ~[stormjar.jar:?] at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:268) ~[stormjar.jar:?] at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:125) ~[stormjar.jar:?] at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:111) ~[stormjar.jar:?] at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:101) ~[stormjar.jar:?] at com.boildata.storm.elasticsearch.common.StormElasticSearchClient.construct(StormElasticSearchClient.java:27) ~[stormjar.jar:?] at com.boildata.storm.elasticsearch.trident.EsState.prepare(EsState.java:46) ~[stormjar.jar:?] at com.boildata.storm.elasticsearch.trident.EsStateFactory.makeState(EsStateFactory.java:29) ~[stormjar.jar:?] at org.apache.storm.trident.planner.SubtopologyBolt.prepare(SubtopologyBolt.java:68) ~[storm-core-1.0.1.2.5.0.0-1245.jar:1.0.1.2.5.0.0-1245] at org.apache.storm.trident.topology.TridentBoltExecutor.prepare(TridentBoltExecutor.java:245) ~[storm-core-1.0.1.2.5.0.0-1245.jar:1.0.1.2.5.0.0-1245] at org.apache.storm.daemon.executor$fn__6571$fn__6584.invoke(executor.clj:798) ~[storm-core-1.0.1.2.5.0.0-1245.jar:1.0.1.2.5.0.0-1245] at org.apache.storm.util$async_loop$fn__554.invoke(util.clj:482) [storm-core-1.0.1.2.5.0.0-1245.jar:1.0.1.2.5.0.0-1245] at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]