【发布时间】:2015-10-26 21:51:25
【问题描述】:
当我尝试提交拓扑时,我发现了这个
Exception in thread "main" java.lang.RuntimeException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar.
at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:115)
at backtype.storm.utils.Utils.readDefaultConfig(Utils.java:135)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:155)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:61)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:40)
at trident.myproject.main(myproject.java:288)
但是这个错误是在pom.xml中更新后出现的
<scope>compile</scope> instead of <scope>provided</scope>
因为我是一个错误
An exception occured while executing the Java class. storm/trident/state/StateFactory
这里是pom文件
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>trident.myproject</mainClass>
<!-- <mainClass>crawler.Crawler</mainClass> -->
</manifest>
</archive>
</configuration>
pom 文件的第二部分
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
pom 文件第三部分
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
【问题讨论】:
-
您的 jar 中似乎仍然包含
defaults.yaml。打包前有没有试过mvn clean?你如何包装你的罐子?也许您需要明确排除该文件。 -
是的,我尝试 mvn clean 现在项目的 pom 文件包含
provided 并尝试使用此命令 mvn compile exec:java -Dexec.classPathScope=compile -Dexec.mainClass =trident.TheProject,结果是执行 Java 类时发生异常。风暴/三叉戟/国家/国家工厂 -
你能发布错误消息/堆栈跟踪吗?您是否尝试通过
storm jar myJarFile.jar package.and.MyMainClass提交? -
是的,我使用了storm jar target/jarfile.jar trident.class 拓扑名称,但我有一个问题,我尝试使用 mvn compile exec:java -Dexec.classPathScope= 在本地模式下运行项目compile -Dexec.mainClass=trident.class 然后出现错误“执行 Java 类时发生异常。storm/trident/state/StateFactory”有人建议我将 pom 文件的范围从提供更改为编译,然后它运行良好然后得到尝试提交拓扑时出现上述错误!但是项目和编码器的范围没有改变,所以在找到 statefactory 时出错
标签: java maven apache-storm