简体   繁体   English

线程“ main”中的异常java.lang.RuntimeException:执行Storm时发现了多个defaults.yaml资源

[英]Exception in thread “main” java.lang.RuntimeException: Found multiple defaults.yaml resources while executing Storm

I am trying to execute the tutorial found here http://virajonlinetutor.blogspot.in/ 我正在尝试执行http://virajonlinetutor.blogspot.in/中的教程

Kafka storm Topology code is : 卡夫卡风暴的拓扑代码是:

package com.storm;

import storm.kafka.KafkaSpout;
import storm.kafka.SpoutConfig;
import storm.kafka.StringScheme;
import storm.kafka.ZkHosts;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.spout.SchemeAsMultiScheme;
import backtype.storm.topology.TopologyBuilder;

public class KafkaStormTopology {
public static void main(String[] args) {
  ZkHosts zk = new ZkHosts("10.25.3.208:2181");
  SpoutConfig config = new SpoutConfig(zk,"deepthy","",
"KafkaStorm");

 config.scheme = new SchemeAsMultiScheme(new StringScheme());

  config.forceFromStart = true;

  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("KafkaSpout", new KafkaSpout(config), 1);
  builder.setBolt("Bolt", new FileBolt(), 1).globalGrouping("KafkaSpout");

  LocalCluster cluster = new LocalCluster();

  Config conf = new Config();
  conf.setDebug(true);
  cluster.submitTopology("SampleTopology", conf, builder.createTopology());
 }
}

My pom.xml: 我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.deepthy.storm</groupId>
<artifactId>Storm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Storm</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
    <repository>
        <id>clojars.org</id>
        <url>http://clojars.org/repo</url>
    </repository>
    <repository>
        <id>central</id>
        <url>http://repo1.maven.org/maven2/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
      <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.2-incubating</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-kafka</artifactId>
        <version>0.9.2-incubating</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.storm.KafkaStormTopology</mainClass>
</manifest>
 </archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
 </goals>
 </execution>
</executions>
</plugin>
</plugins>
</build>
</project>

I get the following error: 我收到以下错误:

Exception in thread "main" java.lang.RuntimeException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar. [jar:file:/usr/hdp/2.3.0.0-2557/storm/lib/storm-core-0.10.0.2.3.0.0-2557.jar!/defaults.yaml, jar:file:/usr/hdp/2.3.0.0-2557/storm/S1.jar!/defaults.yaml]
    at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:140)
    at backtype.storm.utils.Utils.readDefaultConfig(Utils.java:167)
    at backtype.storm.utils.Utils.readStormConfig(Utils.java:191)
    at backtype.storm.config$read_storm_config.invoke(config.clj:121)
    at backtype.storm.command.config_value$_main.invoke(config_value.clj:22)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at backtype.storm.command.config_value.main(Unknown Source)

I tried changing the scope from 'compile' to 'provided' in pom.xml ,but getting the same error. 我尝试将pom.xml中的范围从“编译”更改为“提供”,但是遇到相同的错误。

Any suggestions regarding how to solve this. 有关如何解决此问题的任何建议。

Your jar contains the file defaults.yaml which in not allowed. 您的jar包含不允许的文件defaults.yaml You need to exclude the file from your jar assembly step. 您需要从jar组装步骤中排除文件。 I would recommend to use maven-jar-plugin instead of maven-assembly-plugin and to include all needed files "manually" -- this also help to "minimize" your jar to only contain stuff you need: 我建议使用maven-jar-plugin代替maven-assembly-plugin并“手动”包含所有需要的文件-这还有助于“最小化”您的jar,使其仅包含您需要的内容:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>

        <executions>
                <execution>
                    <id>YOUR-ID</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <finalName>JAR-FILE-NAME-PREFIX</finalName>
                        <classifier>JAR-FILE-NAME-SUFFIX</classifier>

                        <archive>
                            <manifestEntries>
                                <mainClass>com.storm.KafkaStormTopology</mainClass>
                            </manifestEntries>
                        </archive>

                        <includes>
                            <include>packages/to/include/**/*.java</include>
                            <!-- more include here -->
                        <includes>
                    </configuration>
                </execution>
        </executions>
</plugin>

exclude default.yaml file in pom file. 在pom文件中排除default.yaml文件。

in your shade plugin add : META-INF/ .SF META-INF/ .DSA META-INF/ .RSA .yaml 在您的阴影插件中添加 META-INF / .SF META-INF / .DSA META-INF / .RSA .yaml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找到了多个defaults.yaml资源 - Found multiple defaults.yaml resources 找到多个defaults.yaml资源。 您可能将Storm jar与拓扑jar捆绑在一起 - Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar 线程“main”中的异常java.lang.RuntimeException:找不到OpenGL上下文 - Exception in thread “main” java.lang.RuntimeException: No OpenGL context found Java错误:线程“ main”中的异常java.lang.RuntimeException - Java Errors: Exception in thread “main” java.lang.RuntimeException 线程“ main”中的异常java.lang.RuntimeException:无法编译的源代码 - Exception in thread “main” java.lang.RuntimeException: Uncompilable source code 线程“main”中的异常java.lang.RuntimeException:Stub - Exception in thread “main” java.lang.RuntimeException: Stub 线程“主”java.lang.RuntimeException 中的错误异常 - Error Exception in thread "main" java.lang.RuntimeException 线程“ main”中的异常java.lang.RuntimeException:无法启动Selenium会话:找不到 - Exception in thread “main” java.lang.RuntimeException: Could not start Selenium session: Not Found 线程“main”中的异常 java.lang.RuntimeException:尚未实现 - Exception in thread "main" java.lang.RuntimeException: Not yet implemented 线程“main”中的异常 java.lang.RuntimeException: Stub XmlPullParserFactory - Exception in thread "main" java.lang.RuntimeException: Stub XmlPullParserFactory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM