错误:找不到或加载主类com.spsaroj.storm.WordCountTopology即使在编译和提供之间切换范围之后

问题描述

我有以下依赖项

<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.storm</groupId>
      <artifactId>storm-client</artifactId>
      <version>2.2.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

我使用的代码来自storm-starter。 然后我做了mvn clean compile package -DskipTests=true,它在./target文件夹中创建了一个胖子。称为“ stormedurika-1.0-SNAPSHOT.jar”。

我已经有Zookeeper服务器,storm nimbusstorm supervisorstorm ui正在运行。

然后我运行storm jar ./target/stormedurika-1.0-SNAPSHOT.jar com.spsaroj.storm.WordCountTopology word-count -c nimbus.host=localhost,使其运行并显示在http:// localhost:8080 /的Storm UI中,这是Storm UI的运行位置。 WordCountTopology.java是我的拓扑的名称,并且拓扑的名称是单词计数。 拓扑代码如下:

public class WordCountTopology extends Configurabletopology {
    public static void main(String[] args) throws Exception {
        Configurabletopology.start(new WordCountTopology(),args);  // Error here
    }

    @Override
    protected int run(String[] args) throws Exception {

        TopologyBuilder builder = new TopologyBuilder();

        builder.setspout("spout",new RandomSentencespout(),5);

        builder.setBolt("split",new SplitSentenceBolt(),8).shuffleGrouping("spout");
        builder.setBolt("count",new WordCountBolt(),12).fieldsGrouping("split",new Fields("word"));

        conf.setDebug(true);

        String topologyName = "word-count";

        conf.setNumWorkers(3);

        if (args != null && args.length > 0) {
            topologyName = args[0];
        }
        return submit(topologyName,conf,builder);     // Error here
    }

}

但是出现错误“找不到或加载主类com.spsaroj.storm.WordCountTopology”。任何帮助将不胜感激。谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)