【问题标题】:How to include dependencies with Maven in Storm topology jar for cluster deployment?如何在 Storm 拓扑 jar 中包含 Maven 的依赖项以进行集群部署?
【发布时间】:2021-01-11 12:11:46
【问题描述】:

我正在尝试将 Storm 拓扑部署到本地独立集群。我将包含指向我的项目Github repo 的链接,以便您查看我的代码...

我有一个在本地模式下运行的simple Storm topology,我有一个tweaked to deploy 到一个Dockerized 集群(simple configuration 基于recommended instructions)。

但是,当我尝试让它运行时,我得到了这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: backtype/storm/topology/IRichSpout 

this question 看来,我只需要在构建topology.jar 时将storm-core 作为依赖项包含在我的Maven 项目中。

所以我将adjusted my pom.xml 文件(我没有使用Eclipse 或任何IDE,我只是从命令行运行Maven)包含storm-core 作为依赖项,并包含maven-assembly-plugin 来打包jar-with-dependencies。但是现在当我尝试运行集群时,我收到一条错误消息:

...
java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar
...

那么我究竟应该将哪些内容作为捆绑依赖项包含在内?我需要在pom.xml 中添加/删除哪些代码行才能使其正常工作?

【问题讨论】:

    标签: java docker maven jar apache-storm


    【解决方案1】:

    我已经搞定了。

    问题在于 Docker 集群上的 Storm 依赖项归档在 org.apache.storm 下,而本地构建使用 backtype.stormChanging the referencesorg.apache.storm 似乎成功了。

    【讨论】:

      【解决方案2】:

      你应该在 pom.xml 文件的storm依赖中添加“provided”范围。

      【讨论】:

      • 当我这样做时,我得到 NoClassDefFoundError。可以看到pom.xml文件here
      • maven 好像找不到源文件。您可以将源目录标签添加到 pom 文件的构建部分吗? @彼得普雷斯科特
      • 啊,我已经修好了,看我的回答。
      • 哦,好的!太棒了:D
      猜你喜欢
      • 2015-12-10
      • 1970-01-01
      • 2015-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      相关资源
      最近更新 更多