[Flink] flink 실행jar 오류:java.io.IO 예외: Input Split 파일이나java를 여는 중 오류가 발생했습니다.io.FileNotFoundException

4026 단어

오보 내용


flink가 jar를 실행할 때 다음과 같은 오류를 보고합니다.
org.apache.flink.client.program.ProgramInvocationException: Job failed. (JobID: b67d4b36791bb6d1be532323b4f77162)
    at org.apache.flink.client.program.rest.RestClusterClient.submitJob(RestClusterClient.java:268)
    at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:486)
    at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:474)
    at org.apache.flink.client.program.ContextEnvironment.execute(ContextEnvironment.java:62)
    at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:816)
    at org.apache.flink.api.java.DataSet.collect(DataSet.java:413)
    at org.apache.flink.api.java.DataSet.print(DataSet.java:1652)
    at org.apache.flink.examples.java.wordcount.WordCount.main(WordCount.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
    at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
    at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:426)
    at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:816)
    at org.apache.flink.client.cli.CliFrontend.runProgram(CliFrontend.java:290)
    at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:216)
    at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1053)
    at org.apache.flink.client.cli.CliFrontend.lambda$main$11(CliFrontend.java:1129)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1836)
    at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
    at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1129)
Caused by: org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
    at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:146)
    at org.apache.flink.client.program.rest.RestClusterClient.submitJob(RestClusterClient.java:265)
    ... 24 more
Caused by: java.io.IOException: Error opening the Input Split file:/opt/module/logs/student.txt [0,144]: /opt/module/logs/student.txt ( )
    at org.apache.flink.api.common.io.FileInputFormat.open(FileInputFormat.java:824)
    at org.apache.flink.api.common.io.DelimitedInputFormat.open(DelimitedInputFormat.java:470)
    at org.apache.flink.api.common.io.DelimitedInputFormat.open(DelimitedInputFormat.java:47)
    at org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:170)
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: /opt/module/logs/student.txt ( )
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.(FileInputStream.java:138)
    at org.apache.flink.core.fs.local.LocalDataInputStream.(LocalDataInputStream.java:50)
    at org.apache.flink.core.fs.local.LocalFileSystem.open(LocalFileSystem.java:142)
    at org.apache.flink.api.common.io.FileInputFormat$InputSplitOpenThread.run(FileInputFormat.java:996)

문제의 원인

  • 입력 경로에 파일이 존재하지 않습니다
  • 경로를 입력한 파일은 flink 집단의 TaskManager에 있지 않고 JobManager 노드에 놓여 있습니다..

  • 해결 방법

  • 존재하지 않는 파일에 대해 이 파일이 있는 경로로 수정합니다
  • 만약flink가 파일을 로컬 파일로 입력한다면 이 파일을 TaskManager 노드 (즉slaves 노드) 에 놓아야 한다
  • 좋은 웹페이지 즐겨찾기