我正在尝试写一些输出到S3使用电子病历与Flink。我使用的是Scala 2.11.7、Flink 1.3.2和EMR 5.11。但是,我得到了以下错误:
java.lang.NoSuchMethodError: org.apache.hadoop.conf.Configuration.addResource(Lorg/apache/hadoop/conf/Configuration;)V
at com.amazon.ws.emr.hadoop.fs.EmrFileSystem.initialize(EmrFileSystem.java:93)
at org.apache.flink.runtime.fs.hdfs.HadoopFileSystem.initialize(HadoopFileSystem.java:345)
at org.apache.flink.core.fs.FileSystem.getUnguardedFileSystem(FileSystem.java:350)
at org.apache.flink.core.fs.FileSystem.get(FileSystem.java:389)
at org.apache.flink.core.fs.Path.getFileSystem(Path.java:293)
at org.apache.flink.api.common.io.FileOutputFormat.open(FileOutputFormat.java:222)
at org.apache.flink.api.java.io.TextOutputFormat.open(TextOutputFormat.java:78)
at org.apache.flink.streaming.api.functions.sink.OutputFormatSinkFunction.open(OutputFormatSinkFunction.java:61)
at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:36)
at org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:111)
at org.apache.flink.streaming.runtime.tasks.StreamTask.openAllOperators(StreamTask.java:376)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:253)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:702)
at java.lang.Thread.run(Thread.java:748)我的build.sbt看起来像这样:
libraryDependencies ++= Seq(
"org.apache.flink" % "flink-core" % "1.3.2",
"org.apache.flink" % "flink-scala_2.11" % "1.3.2",
"org.apache.flink" % "flink-streaming-scala_2.11" % "1.3.2",
"org.apache.flink" % "flink-shaded-hadoop2" % "1.3.2",
"org.apache.flink" % "flink-clients_2.11" % "1.3.2",
"org.apache.flink" %% "flink-avro" % "1.3.2",
"org.apache.flink" %% "flink-connector-filesystem" % "1.3.2"
)我也找到了这篇文章,但它并没有解决这个问题:External checkpoints to S3 on EMR
我只是将输出放到S3:input.writeAsText("s3://test/flink")中。如有任何建议,我们将不胜感激。
发布于 2018-01-23 03:48:57
不确定flink-shaded-hadoop和EMR版本的良好组合。在几次尝试和失败之后,我能够使用flink-shaded-hadoop2的一个新版本-- "org.apache.flink" % "flink-shaded-hadoop2" % "1.4.0" --来写入S3
发布于 2020-05-17 02:55:37
你的问题可能是因为EMR/Yarn/Flink在你自己的类之前加载了一些库,导致NoSuchMethodError:加载的类不是你提供的类,而是EMR提供的类。注意JobManager/TaskManager日志中的类路径。一种解决方案是将您自己的jars放在Flink lib目录中,以便在EMR之前加载它们。
https://stackoverflow.com/questions/48388074
复制相似问题