maven - Apache beam WordCount在windows下运行报错

标签 maven google-cloud-dataflow apache-beam

尝试运行WordCount首先运行 Apache Beam(版本 2.0.0)的示例

$ mvn archetype:generate \
  -DarchetypeGroupId=org.apache.beam \
  -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
  -DarchetypeVersion=2.0.0 \
  -DgroupId=org.example \
  -DartifactId=word-count-beam \
  -Dversion="0.1" \
  -Dpackage=org.apache.beam.examples \
  -DinteractiveMode=false

然后运行

$ mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount -Dexec.args="--inputFile=pom.xml --output=counts" -Pdirect-runner

并出现以下错误

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project word-count-beam: An exception occured while executing the Java class. null: InvocationTargetException: java.lang.IllegalStateException: U nable to find registrar for d -> [Help 1]

但是,如果我运行 2017 年 3 月下载并构建的同一项目(Beam v0.6.0),一切正常。我只是想知道 Beam 版本的哪些更新会导致此错误。

最佳答案

发生此错误的原因是 TextIO#from("path_to_file") 方法不支持 Windows 文件系统路径。 例如,以下代码抛出 IllegalStateException:

TextIO.read().from("d:\\file.txt") // also "file:\\D:\\file.txt" throw exc

Exception in thread "main" org.apache.beam.sdk.Pipeline$PipelineExecutionException: java.lang.IllegalStateException: Unable to find registrar for d

我希望 Apache Beam 团队能够在不久的将来修复它......

关于maven - Apache beam WordCount在windows下运行报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44147535/

相关文章:

tensorflow - 我可以将辅助输入传递给 Apache Beam PTransforms 吗?

maven - 露天 Solr "aclchangesets return status:403"

maven - 为sonar2.12配置jacoco代理(多模块maven)

java - Jenkins 和 Tomcat 7 - 已部署应用程序,但上下文无法启动

google-cloud-dataflow - 水印卡住了

google-cloud-dataflow - Apache Beam/数据流改组

java - 如何修复从 GCP 中的虚拟机实例运行数据流模板时出现的 "Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java"错误?

java.lang.NoClassDefFoundError : org/apache/beam/sdk/coders/CoderProviderRegistrar

python - 使用 Dataflow 进行图像预处理

java - 如何使用 java(spring) 将 json 对象消息生成到 kafka 主题中?