2016-04-27 5 views
0

Я работаю над топологией образца (один носик ОНТ болт), но Когда я запускаю мой шторм проект с помощью командной строки:Apache Сторм: SLF4J: путь Класс содержит несколько привязок SLF4J

шторма баночка мишень/разъема -0.0.1-ПАНОРАМА-банку-с-dependencies.jar topology.ConnectorTopology

я получаю ошибку

SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/usr/share/storm/lib/log4j-slf4j-impl-2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] 
Exception in thread "main" java.lang.ExceptionInInitializerError 
     at org.apache.storm.config$read_storm_config.invoke(config.clj:78) 
     at org.apache.storm.config$fn__904.invoke(config.clj:100) 
     at org.apache.storm.config__init.load(Unknown Source) 
     at org.apache.storm.config__init.<clinit>(Unknown Source) 
     at java.lang.Class.forName0(Native Method) 
     at java.lang.Class.forName(Class.java:278) 
     at clojure.lang.RT.classForName(RT.java:2154) 
     at clojure.lang.RT.classForName(RT.java:2163) 
     at clojure.lang.RT.loadClassForName(RT.java:2182) 
     at clojure.lang.RT.load(RT.java:436) 
     at clojure.lang.RT.load(RT.java:412) 
     at clojure.core$load$fn__5448.invoke(core.clj:5866) 
     at clojure.core$load.doInvoke(core.clj:5865) 
     at clojure.lang.RestFn.invoke(RestFn.java:408) 
     at clojure.core$load_one.invoke(core.clj:5671) 
     at clojure.core$load_lib$fn__5397.invoke(core.clj:5711) 
     at clojure.core$load_lib.doInvoke(core.clj:5710) 
     at clojure.lang.RestFn.applyTo(RestFn.java:142) 
     at clojure.core$apply.invoke(core.clj:632) 
     at clojure.core$load_libs.doInvoke(core.clj:5753) 
     at clojure.lang.RestFn.applyTo(RestFn.java:137) 
     at clojure.core$apply.invoke(core.clj:634) 
     at clojure.core$use.doInvoke(core.clj:5843) 
     at clojure.lang.RestFn.invoke(RestFn.java:408) 
     at org.apache.storm.command.config_value$loading__5340__auto____12655.invoke(config_value.clj:16) 
     at org.apache.storm.command.config_value__init.load(Unknown Source) 
     at org.apache.storm.command.config_value__init.<clinit>(Unknown Source) 
     at java.lang.Class.forName0(Native Method) 
     at java.lang.Class.forName(Class.java:278) 
     at clojure.lang.RT.classForName(RT.java:2154) 
     at clojure.lang.RT.classForName(RT.java:2163) 
     at clojure.lang.RT.loadClassForName(RT.java:2182) 
     at clojure.lang.RT.load(RT.java:436) 
     at clojure.lang.RT.load(RT.java:412) 
     at clojure.core$load$fn__5448.invoke(core.clj:5866) 
     at clojure.core$load.doInvoke(core.clj:5865) 
     at clojure.lang.RestFn.invoke(RestFn.java:408) 
     at clojure.lang.Var.invoke(Var.java:379) 
     at org.apache.storm.command.config_value.<clinit>(Unknown Source) 
Caused by: java.lang.RuntimeException: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/usr/share/storm/lib/storm-core-1.0.0.jar!/defaults.yaml] 
     at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:307) 
     at org.apache.storm.utils.Utils.readDefaultConfig(Utils.java:351) 
     at org.apache.storm.utils.Utils.readStormConfig(Utils.java:387) 
     at org.apache.storm.utils.Utils.<clinit>(Utils.java:119) 
     ... 39 more 
Caused by: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/usr/share/storm/lib/storm-core-1.0.0.jar!/defaults.yaml] 
     at org.apache.storm.utils.Utils.getConfigFileInputStream(Utils.java:333) 
     at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:287) 
     ... 42 more 
Running: java -client -Ddaemon.name= -Dstorm.options= -Dstorm.home=/usr/share/storm -Dstorm.log.dir=/usr/share/storm/logs -Djava.library.path= -Dstorm.conf.file= -cp /usr/share/storm/lib/disruptor-3.3.2.jar:/usr/share/storm/lib/storm-core-1.0.0.jar:/usr/share/storm/lib/slf4j-api-1.7.7.jar:/usr/share/storm/lib/objenesis-2.1.jar:/usr/share/storm/lib/log4j-core-2.1.jar:/usr/share/storm/lib/log4j-api-2.1.jar:/usr/share/storm/lib/reflectasm-1.10.1.jar:/usr/share/storm/lib/storm-rename-hack-1.0.0.jar:/usr/share/storm/lib/asm-5.0.3.jar:/usr/share/storm/lib/clojure-1.7.0.jar:/usr/share/storm/lib/log4j-over-slf4j-1.6.6.jar:/usr/share/storm/lib/servlet-api-2.5.jar:/usr/share/storm/lib/kryo-3.0.3.jar:/usr/share/storm/lib/minlog-1.3.0.jar:/usr/share/storm/lib/log4j-slf4j-impl-2.1.jar:target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar:/usr/share/storm/conf:/usr/share/storm/bin -Dstorm.jar=target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar topology.ConnectorTopology 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/usr/share/storm/lib/log4j-slf4j-impl-2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] 
Exception in thread "main" java.lang.ExceptionInInitializerError 
     at org.apache.storm.topology.BaseConfigurationDeclarer.<init>(BaseConfigurationDeclarer.java:26) 
     at org.apache.storm.topology.TopologyBuilder$ConfigGetter.<init>(TopologyBuilder.java:406) 
     at org.apache.storm.topology.TopologyBuilder$SpoutGetter.<init>(TopologyBuilder.java:423) 
     at org.apache.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:295) 
     at org.apache.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:278) 
     at topology.ConnectorTopology.main(ConnectorTopology.java:34) 
Caused by: java.lang.RuntimeException: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/usr/share/storm/lib/storm-core-1.0.0.jar!/defaults.yaml] 
     at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:307) 
     at org.apache.storm.utils.Utils.readDefaultConfig(Utils.java:351) 
     at org.apache.storm.utils.Utils.readStormConfig(Utils.java:387) 
     at org.apache.storm.utils.Utils.<clinit>(Utils.java:119) 
     ... 6 more 
Caused by: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/usr/share/storm/lib/storm-core-1.0.0.jar!/defaults.yaml] 
     at org.apache.storm.utils.Utils.getConfigFileInputStream(Utils.java:333) 
     at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:287) 
     ... 9 more 

мой конфигурационный файл ПОМ:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
     <modelVersion>4.0.0</modelVersion> 
     <groupId>com.project.connector</groupId> 
     <artifactId>connector</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 


<build> 
    <plugins> 
    <plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <configuration> 
     <archive> 
      <manifest> 
      <mainClass>com.project.connector.ConnectorTopology</mainClass> 
      </manifest> 
     </archive> 
     <descriptorRefs> 
      <descriptorRef>jar-with-dependencies</descriptorRef> 
     </descriptorRefs> 
     </configuration> 

    </plugin> 
    </plugins> 
</build> 

     <dependencies> 

       <dependency> 
         <groupId>com.rabbitmq</groupId> 
         <artifactId>amqp-client</artifactId> 
         <version>3.6.1</version> 
       </dependency> 

       <dependency> 
         <groupId>org.eclipse.paho</groupId> 
         <artifactId>org.eclipse.paho.client.mqttv3</artifactId> 
         <version>1.0.2</version> 
       </dependency> 

       <dependency> 
         <groupId>org.codehaus.plexus</groupId> 
         <artifactId>plexus-utils</artifactId> 
         <version>3.0.22</version> 
       </dependency> 

       <dependency> 
         <groupId>org.apache.storm</groupId> 
         <artifactId>storm-core</artifactId> 
         <version>1.0.0</version> 
       </dependency> 


     </dependencies> 
</project> 

Я пытался много решений, которые я нашел в Интернете, но не результат. есть ли у вас какое-либо представление об источнике проблемы?

ответ

0

Я решил эту проблему, добавив:

<scope>provided</scope> 

и

<exclusions> 
       <exclusion> 
        <groupId>org.slf4j</groupId> 
        <artifactId>log4j-over-slf4j</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.slf4j</groupId> 
        <artifactId>slf4j-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>logback-classic</groupId> 
        <artifactId>ch.qos.logback</artifactId> 
       </exclusion> 
      </exclusions> 

Как это:

<dependency> 
      <groupId>org.apache.storm</groupId> 
      <artifactId>storm-core</artifactId> 
      <version>1.0.0</version> 

      <scope>provided</scope> 
      <exclusions> 
       <exclusion> 
        <groupId>org.slf4j</groupId> 
        <artifactId>log4j-over-slf4j</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.slf4j</groupId> 
        <artifactId>slf4j-api</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>logback-classic</groupId> 
        <artifactId>ch.qos.logback</artifactId> 
       </exclusion> 
      </exclusions> 

     </dependency> 
1

Вы найдете решение здесь: http://www.slf4j.org/codes.html#multiple_bindings

Добавить исключение в зависимости (от pom.xml), которые могут быть вызваны конфликтом.

<exclusions> 
    <exclusion> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-log4j12</artifactId> 
    <version>1.7.xx</version> 
    </exclusion> 
</exclusions> 
+0

Я попытался это решение, но изменить ничего –

+0

вы использовали исключение? –

+0

Да, я сделал, но ничего:/ –

0

Многократное связывание SLF4J приводит к появлению предупреждающего сообщения, но ваша программа будет продолжать работать. Причина Exception вы видите в вашей трассировке стеки:

Вызванный: java.lang.RuntimeException: java.io.IOException: Найдено несколько defaults.yaml ресурсов. Вероятно, вы собрали банки Storm с вашей флягой с топологией. [jar: файл: /root/cloud/connector/target/connector-0.0.1-SNAPSHOT-jar-with-dependencies.jar! /defaults.yaml, jar: файл:/usr/share/storm/lib/ливневых ядро-1.0.0.jar! /defaults.yaml]

Устраните в вашем банке дубликат defaults.yaml.

+0

Где я могу найти default.yaml? –

Смежные вопросы