所以我现在更新了问题和标题,因为现在我知道问题所在了。 这是工作日志,我知道有很多像这样的问题( here ),但无论我做什么,我都找不到任何解决方案。
Edit: It's the same problem as the mentioned in the link but with different cause as mentioned in the answer below.
这是工作日志。
2016-06-23 00:10:56.115 STDERR [INFO] Exception in thread "main" java.lang.ExceptionInInitializerError
2016-06-23 00:10:56.122 STDERR [INFO] at org.apache.storm.config$read_storm_config.invoke(config.clj:78)
2016-06-23 00:10:56.124 STDERR [INFO] at org.apache.storm.daemon.worker$_main.invoke(worker.clj:768)
2016-06-23 00:10:56.124 STDERR [INFO] at clojure.lang.AFn.applyToHelper(AFn.java:165)
2016-06-23 00:10:56.124 STDERR [INFO] at clojure.lang.AFn.applyTo(AFn.java:144)
2016-06-23 00:10:56.125 STDERR [INFO] at org.apache.storm.daemon.worker.main(Unknown Source)
2016-06-23 00:10:56.125 STDERR [INFO] 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:/media/bishoymak/All/College/New%20GP/Second/Programs/storm/lib/storm-core-1.0.1.jar!/defaults.yaml, jar:file:/media/bishoymak/All/College/New%20GP/Second/Programs/storm/storm-local/supervisor/stormdist/LogAnalyserStorm-1-1466632686/stormjar.jar!/defaults.yaml]
2016-06-23 00:10:56.126 STDERR [INFO] at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:307)
2016-06-23 00:10:56.126 STDERR [INFO] at org.apache.storm.utils.Utils.readDefaultConfig(Utils.java:351)
2016-06-23 00:10:56.127 STDERR [INFO] at org.apache.storm.utils.Utils.readStormConfig(Utils.java:387)
2016-06-23 00:10:56.127 STDERR [INFO] at org.apache.storm.utils.Utils.<clinit>(Utils.java:119)
2016-06-23 00:10:56.127 STDERR [INFO] ... 5 more
2016-06-23 00:10:56.128 STDERR [INFO] Caused by: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/media/bishoymak/All/College/New%20GP/Second/Programs/storm/lib/storm-core-1.0.1.jar!/defaults.yaml, jar:file:/media/bishoymak/All/College/New%20GP/Second/Programs/storm/storm-local/supervisor/stormdist/LogAnalyserStorm-1-1466632686/stormjar.jar!/defaults.yaml]
这是我的 pom.xml
<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>StormExample</groupId>
<artifactId>StormExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source/>
<target/>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>LogAnalyserStorm</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<includes>
<include>LogAnalyserStorm.class</include>
<include>FakeCallLogReaderSpout.class</include>
<include>CallLogCounterBolt.class</include>
<include>CallLogCreatorBolt.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.1.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
我使用了 mvn jar:jar 和 mvn package,但它总是包含 Storm 核心,尽管我声明它只包含要包含的 4 个类,所以请告诉我我做错了什么。
这是我的拓扑代码:
public static void main(String[] args) throws Exception{
//Create Config instance for cluster configuration
Config config = new Config();
config.setDebug(true);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("call-log-reader-spout", new FakeCallLogReaderSpout());
builder.setBolt("call-log-creator-bolt", new CallLogCreatorBolt())
.shuffleGrouping("call-log-reader-spout");
builder.setBolt("call-log-counter-bolt", new CallLogCounterBolt())
.fieldsGrouping("call-log-creator-bolt", new Fields("call"));
System.setProperty("storm.jar", "/media/bishoymak/All/College/New GP/Second/Programs/storm/lib/storm-core-1.0.1.jar");
StormSubmitter.submitTopology("LogAnalyserStorm", config, builder.createTopology());
最佳答案
这个问题与 pom.xml 无关,只需删除这一行
System.setProperty("storm.jar", "/media/bishoymak/All/College/New GP/Second/Programs/storm/lib/storm-core-1.0.1.jar");
关于java - 找到多个defaults.yaml资源。您可能将 Storm jar 与您的拓扑 jar 捆绑在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37970365/