Flink解决简单程序Job execution failed报错

Flink解决简单程序Job execution failed报错

不啰嗦,上代码:

object StreamWC{
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    val source: DataStream[String] = env.socketTextStream("bigdata01",8090)
    source.flatMap(line=>line.split("\\W+"))
      .map((_,1))
      .keyBy(0)
      .sum(1)
      .print()

    env.execute()
  }

在运行的过程中,报错:

Exception in thread "main" org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
	at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:146)
	at org.apache.flink.runtime.minicluster.MiniCluster.executeJobBlocking(MiniCluster.java:647)
	at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:123)
	at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1510)
	at org.apache.flink.streaming.api.scala.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.scala:645)
	at newtouch.cn.StreamWC$.main(wordConuter1.scala:16)
	at newtouch.cn.StreamWC.main(wordConuter1.scala)

经过查看发现:
这个Wordcounter程序中的配置:
env.socketTextStream(“bigdata01”,8090)
就是监听bigdata01主机的8090端口,然后在bigdata01中输入以下命令:
nc -lk 8090
然后输入数据,这样就可以得出结果了。

[root@bigdata01 flink-1.7.0]# nc -lk 8090
aa aa bb aa aa aa bb cc aa aa bb cc ee aa bb cc aa
aa aa aa bb cc aa aa aa go go go go
D:\Java\jdk1.8.0_65\bin\java.exe "-javaagent:D:\IntelliJ IDEA 
7> (aa,1)
12> (cc,1)
7> (aa,2)
8> (go,1)
7> (aa,3)
7> (bb,1)
8> (go,2)
7> (aa,4)
8> (go,3)
8> (go,4)
7> (aa,5)
7> (aa,6)
12> (cc,2)
7> (aa,7)
7> (aa,8)
12> (cc,3)
1> (ee,1)
12> (cc,4)
7> (bb,2)
7> (aa,9)
7> (aa,10)
7> (aa,11)
7> (bb,3)
7> (aa,12)
7> (aa,13)
7> (bb,4)
7> (aa,14)
7> (bb,5)
7> (aa,15)``

你可能感兴趣的:(ETL,flink)