2014-02-26 49 views
3

我正在使用storm jar类将拓扑提交到`nimbus'。它在本地工作正常,但在远程集群上它说它无法加载主类。下面是运行Storm Topology时找不到主类

stderr: SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/usr/local/storm-0.9.0.1/lib/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/tmp/storm-starter.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
Error: Could not find or load main class ExclamationTopology 

我在CLI运行以下命令的错误:

usr/local/storm/bin/storm jar /tmp/storm-starter.jar ExclamationTopology 

回答

-3

尝试运行这样的:

java -jar /tmp/storm-starter.jar ExclamationTopology 

来到这里的答案:Run Jar in Console

+3

错错错!你回答与Storm – Chiron

+1

无关,实际上它是'暴风雨 - starter.jar storm.starter.ExclamationTopology测试',其中test是拓扑名称 – Volatil3

2

有有可能是storm-starter.jar的包装问题:这个jar不应该包含sl4j的实现。为了封装风暴起动示例(https://github.com/nathanmarz/storm-starter),运行从根文件夹下面的命令(其中M2-pom.xml的存在):

mvn -f m2-pom.xml package 

这应该在目标/文件夹产生这个文件:

storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar 

然后,为了将它部署到集群(事实上,通过雨云),你需要告诉给storm jar命令包含提供拓扑定义main()类的全名,像这样(确保你使用“-with-dependencies”):

usr/local/storm/bin/storm jar storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.ExclamationTopology 
+0

是。我在IntelliJ-IDE中添加了额外的库。 – Volatil3

0

我有类似的风暴错误,&它通过添加在pom.xml中提供了修复。当你添加提供时,maven不会将这些库绑定到jar中。

3

对我来说,这是一个类路径问题。一旦我遍历到jar所在的目录,并运行命令,一切正常。

从风暴的主文件夹运行

./bin/storm jar examples/storm-starter/storm-starter-topologies-0.9.3.jar storm.starter.WordCountTopology TOne 

Failed with error: Error: Could not find or load main class storm.starter.WordCountTopology 

Running from directory examples/storm-starter 

/root/storm/apache-storm-0.10.0/bin/storm jar storm-starter-topologies-0.10.0.jar storm.starter.WordCountTopology TOne 

工作的罚款。

+0

是的,'风暴'和罐子必须是完整的路径... – FaithReaper