找不到或无法加载主类
程序员文章站
2022-05-23 08:34:53
...
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStreamSource<String> lines = env.socketTextStream("localhost", 8888);
SingleOutputStreamOperator<Tuple2<String, Integer>> wordAndOne = lines.map(new MapFunction<String, Tuple2<String, Integer>>() {
@Override
public Tuple2<String, Integer> map(String value) throws Exception {
String[] fields = value.split(",");
return Tuple2.of(fields[0], Integer.parseInt(fields[1]));
}
});
KeyedStream<Tuple2<String, Integer>, Tuple> keyBy = wordAndOne.keyBy(0);
SingleOutputStreamOperator<Tuple2<String, Integer>> max = keyBy.max(1);
max.print();
env.execute();
解决:
检查target发现没有这个类
使用maven先clean再package
运行成功
下一篇: 查询购物车