问答详情
源自:5-3 StormAPI使用下

WordCountTopology.java 缺少backType package

javac WordCountTopology.java

WordCountTopology.java:20: package backtype.storm does not exist
import backtype.storm.Config;
                     ^
WordCountTopology.java:21: package backtype.storm does not exist
import backtype.storm.LocalCluster;
                     ^
WordCountTopology.java:22: package backtype.storm does not exist
import backtype.storm.StormSubmitter;
                     ^
WordCountTopology.java:23: package backtype.storm.task does not exist
import backtype.storm.task.ShellBolt;
                          ^
WordCountTopology.java:24: package backtype.storm.topology does not exist
import backtype.storm.topology.BasicOutputCollector;
                              ^
WordCountTopology.java:25: package backtype.storm.topology does not exist
import backtype.storm.topology.IRichBolt;
                              ^
WordCountTopology.java:26: package backtype.storm.topology does not exist
import backtype.storm.topology.OutputFieldsDeclarer;
                              ^
WordCountTopology.java:27: package backtype.storm.topology does not exist
import backtype.storm.topology.TopologyBuilder;
                              ^
WordCountTopology.java:28: package backtype.storm.topology.base does not exist
import backtype.storm.topology.base.BaseBasicBolt;
                                   ^
WordCountTopology.java:29: package backtype.storm.tuple does not exist
import backtype.storm.tuple.Fields;
                           ^
WordCountTopology.java:30: package backtype.storm.tuple does not exist
import backtype.storm.tuple.Tuple;
                           ^
WordCountTopology.java:31: package backtype.storm.tuple does not exist
import backtype.storm.tuple.Values;
                           ^
WordCountTopology.java:32: package storm.starter.spout does not exist
import storm.starter.spout.RandomSentenceSpout;
                          ^
WordCountTopology.java:41: cannot find symbol
symbol  : class ShellBolt
location: class storm.starter.WordCountTopology
  public static class SplitSentence extends ShellBolt implements IRichBolt {
                                            ^
WordCountTopology.java:41: cannot find symbol
symbol  : class IRichBolt
location: class storm.starter.WordCountTopology
  public static class SplitSentence extends ShellBolt implements IRichBolt {
                                                                 ^
WordCountTopology.java:48: cannot find symbol
symbol  : class OutputFieldsDeclarer
location: class storm.starter.WordCountTopology.SplitSentence
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
                                    ^
WordCountTopology.java:58: cannot find symbol
symbol  : class BaseBasicBolt
location: class storm.starter.WordCountTopology
  public static class WordCount extends BaseBasicBolt {
                                        ^
WordCountTopology.java:62: cannot find symbol
symbol  : class Tuple
location: class storm.starter.WordCountTopology.WordCount
    public void execute(Tuple tuple, BasicOutputCollector collector) {
                        ^
WordCountTopology.java:62: cannot find symbol
symbol  : class BasicOutputCollector
location: class storm.starter.WordCountTopology.WordCount
    public void execute(Tuple tuple, BasicOutputCollector collector) {
                                     ^
WordCountTopology.java:73: cannot find symbol
symbol  : class OutputFieldsDeclarer
location: class storm.starter.WordCountTopology.WordCount
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
                                    ^
WordCountTopology.java:49: cannot find symbol
symbol  : class Fields
location: class storm.starter.WordCountTopology.SplitSentence
      declarer.declare(new Fields("word"));
                           ^
WordCountTopology.java:47: method does not override or implement a method from a supertype
    @Override
    ^
WordCountTopology.java:52: method does not override or implement a method from a supertype
    @Override
    ^
WordCountTopology.java:69: cannot find symbol
symbol  : class Values
location: class storm.starter.WordCountTopology.WordCount
      collector.emit(new Values(word, count));
                         ^
WordCountTopology.java:61: method does not override or implement a method from a supertype
    @Override
    ^
WordCountTopology.java:74: cannot find symbol
symbol  : class Fields
location: class storm.starter.WordCountTopology.WordCount
      declarer.declare(new Fields("word", "count"));
                           ^
WordCountTopology.java:72: method does not override or implement a method from a supertype
    @Override
    ^
WordCountTopology.java:86: cannot find symbol
symbol  : class TopologyBuilder
location: class storm.starter.WordCountTopology
    TopologyBuilder builder = new TopologyBuilder();
    ^
WordCountTopology.java:86: cannot find symbol
symbol  : class TopologyBuilder
location: class storm.starter.WordCountTopology
    TopologyBuilder builder = new TopologyBuilder();
                                  ^
WordCountTopology.java:88: cannot find symbol
symbol  : class RandomSentenceSpout
location: class storm.starter.WordCountTopology
    builder.setSpout("spout", new RandomSentenceSpout(), 5).setNumTasks(7);
                                  ^
WordCountTopology.java:91: cannot find symbol
symbol  : class Fields
location: class storm.starter.WordCountTopology
    builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word"));
                                                                              ^
WordCountTopology.java:93: cannot find symbol
symbol  : class Config
location: class storm.starter.WordCountTopology
    Config conf = new Config();
    ^
WordCountTopology.java:93: cannot find symbol
symbol  : class Config
location: class storm.starter.WordCountTopology
    Config conf = new Config();
                      ^
WordCountTopology.java:100: cannot find symbol
symbol  : variable StormSubmitter
location: class storm.starter.WordCountTopology
      StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
      ^
WordCountTopology.java:105: cannot find symbol
symbol  : class LocalCluster
location: class storm.starter.WordCountTopology
      LocalCluster cluster = new LocalCluster();
      ^
WordCountTopology.java:105: cannot find symbol
symbol  : class LocalCluster
location: class storm.starter.WordCountTopology
      LocalCluster cluster = new LocalCluster();
                                 ^
36 errors

何解?

提问者:帝国大学 2017-06-30 22:54

个回答

  • FlyingFish86
    2017-08-07 00:40:22

    没有导入storm相关的包