zoukankan      html  css  js  c++  java
  • Storm提交Topology报错:Found multiple defaults.yaml resources.

    Storm提交Topology运行方式分为本地和集群运行两种,其中集群运行需要将程序打包并把jar包复制到集群,通过以下方式执行:

    bin/storm jar /opt/run/storm-demo-1.0-SNAPSHOT-jar-with-dependencies.jar org.mort.storm.kafka.KafkaTopologyBasic
    bin/storm jar [jar包路径] [main所在类名]

    不过有时程序运行报错提示如下:

    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:/opt/run/storm-demo-1.0-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/opt/module/apache-storm-1.2.3/lib/storm-core-1.2.3.jar!/defaults.yaml]
            at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:385)
            at org.apache.storm.utils.Utils.readDefaultConfig(Utils.java:429)
            at org.apache.storm.utils.Utils.readStormConfig(Utils.java:465)
            at org.apache.storm.utils.Utils.<clinit>(Utils.java:179)
            ... 39 more
    Caused by: java.io.IOException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/opt/run/storm-demo-1.0-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml, jar:file:/opt/module/apache-storm-1.2.3/lib/storm-core-1.2.3.jar!/defaults.yaml]
            at org.apache.storm.utils.Utils.getConfigFileInputStream(Utils.java:411)
            at org.apache.storm.utils.Utils.findAndReadConfigFile(Utils.java:364)
            ... 42 more

    出现问题原因是storm-core下面也存在一个defaults.yaml文件,因此storm运行时报错冲突,因此修改Maven配置文件,添加scope属性并设为provided:

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>1.2.3</version>
        <scope>provided</scope>
    </dependency>

    scope设置成provided表示容器或JDK已提供范围,表示该依赖包已经由目标容器(如tomcat)和JDK提供,只在编译的classpath中加载和使用,打包的时候不会包含在目标包中。

    再次运行成功提交。

  • 相关阅读:
    Python字符串学习
    文本压缩版本三
    文件压缩版本二
    文件压缩(2)
    d17包,logging模块,hashlib模块 openpyxl模块,深浅拷贝
    d16 collections模块 时间模块 random模块 os模块 sys模块 序列化模块 subprocess模块
    d15 常用模块之正则模块
    14天 模块 , 导模块 , 循环导入, 相对,绝对导入, 项目目录规范,
    13t天 迭代器,生成器,内置函数
    55 jquery
  • 原文地址:https://www.cnblogs.com/MWCloud/p/11579743.html
Copyright © 2011-2022 走看看