在storm official docker 1.2.1上运行拓扑时出现错误-“找不到或加载主类”

uqzxnwby  于 2021-06-24  发布在  Storm
关注(0)|答案(1)|浏览(284)

我从storm 1.2.1的docker hub中提取了最新的docker图像。并根据项目下的自述文件,将storm源代码1.2.1中的storm starter示例项目打包,并将包重命名为“topology.jar”。但是当我把jar文件提交给storm docker时 $ docker run -it -v $(pwd)/topology.jar:/topology.jar storm storm jar /topology.jar org.apache.storm.starter.ExclamationTopology ,
出现错误:
运行:/usr/lib/jvm/java-1.8-openjdk/jre/bin/java-client-ddaemon.name=-dstorm.options=-dstorm.home=/apache-storm-1.2.1-dstorm.log.dir=/logs-djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib-dstorm.conf.file=-cp/apache-storm-1.2.1/lib/:/apache-storm-1.2.1/extlib/*:/topology.jar:/conf:/apache-storm-1.2.1/bin-dstorm.jar=/topology.jar-dstorm.dependency.jars=-dstorm.dependency.artifacts={}org.apache.storm.starter.惊呼本体论
错误:找不到或加载主类org.apache.storm.starter.惊呼本体论
我在同一个包下添加了一个helloworld类,这个包中只打印了“helloworld!”在主要方法中: public static void main (String[] args) { System.out.println("Hello world!"); } 当我提交这个新的包裹时 $ docker run -it -v $(pwd)/topology.jar:/topology.jar storm storm jar /topology.jar org.apache.storm.starter.HelloWorld ,上面写着“你好,世界!”一如预期。
那么问题是什么呢?感谢您的帮助。
附言。
/topology.jar中的meta info/manifest.mf

Manifest-Version: 1.0
Implementation-Title: storm-starter
Implementation-Version: 2.0.0-SNAPSHOT
Archiver-Version: Plexus Archiver
Built-By: leo
Specification-Vendor: The Apache Software Foundation
Specification-Title: storm-starter
Implementation-Vendor-Id: org.apache.storm
Implementation-Vendor: The Apache Software Foundation
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_121
Specification-Version: 2.0
Implementation-URL: http://storm.apache.org/examples/storm-starter

执行时 jar -tvf topology.jar | grep ExclamationTopology . 控制台已打印
2060周一至2018年3月5日11:40:08 cst org/apache/storm/starter/expromationtopology.class 2242周一至2018年3月5日11:40:08 cst org/apache/storm/starter/expromationtopology$expromationbolt.class
类路径在错误发生时按上述方式打印 -cp 关键字。storm starter的项目结构与github的官方主分支相同。此外,helloworld类与惊呼本体论共享相同的包,惊呼本体论是 org.apache.storm.starter . 你可以参考这里的源代码。

5rgfhyps

5rgfhyps1#

终于,我明白了。storm 1.2.1的docker hub上的docker官方图片缺少名为 ConfigurableTopology . 将它从storm客户端复制为本地包,然后重新编译包。您可以成功提交。

相关问题