【问题标题】:apache storm in cluster mode集群模式下的apache风暴
【发布时间】:2016-03-11 16:57:21
【问题描述】:

我使用 apachestorm 来处理带有 kafka 源的数据,但是当我在集群模式下运行storm时,他为我返回了这个错误: 我使用这个命令行风暴 jar /path 到我的 jar 文件 args1

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:106)
at backtype.storm.utils.Utils.readDefaultConfig(Utils.java:126)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:146)
at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:45)
at com.storm.Topologie.main(Topologie.java:48)

这是我在 pom.xml 中的文件依赖项:

<dependencies>
       <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.5</version>
        <!-- keep storm out of the jar-with-dependencies -->
        <scope>provide</scope>
    </dependency>
          <dependency>
      <groupId>org.apache.storm</groupId>
      <artifactId>storm-kafka</artifactId>
      <version>0.10.0</version>
      <type>jar</type>
  </dependency>
  <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka_2.9.2</artifactId>
      <version>0.8.1.1</version>
      <exclusions>
          <exclusion>
              <groupId>org.apache.zookeeper</groupId>
              <artifactId>zookeeper</artifactId>
          </exclusion>
          <exclusion>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
          </exclusion>
      </exclusions>
  </dependency>

以及我的 pom.xml 的最后一部分

<build>
 <plugins>
   <plugin>
     <artifactId>maven-assembly-plugin</artifactId>
     <configuration>
       <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
       </descriptorRefs>
      <archive>
        <manifest>
         <mainClass>com.storm.Topologie</mainClass>
        </manifest>
      </archive>

     </configuration>
   <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
   </plugin>

【问题讨论】:

    标签: java maven apache-kafka apache-storm


    【解决方案1】:
    <scope>provide</scope>
    

    那个“范围”是无效的。名称是“提供”:

    <scope>provided</scope>
    

    您的 maven 作业是否使用该 pom.xml 成功运行?检查一下,您也可能正在尝试从以前成功的构建中发布工件(胖 jar)。也尝试执行clean 目标。

    【讨论】:

    • 非常感谢它运行良好,我还删除了 jara 文件中的 defaults.yaml 文件,它运行正常
    • 您可以使用以下命令从jar zip -dstorm-example.jar defaults.yaml 中删除defaults.yaml
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-01
    • 2016-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多