Apache 光束 WordCount 在 Windows 中运行错误 [英] Apache beam WordCount running error in windows

查看:30
本文介绍了Apache 光束 WordCount 在 Windows 中运行错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试运行 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

并收到以下错误

<块引用>

[错误] 无法在 word-count-beam 项目上执行目标 org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli):执行Java 类.null:InvocationTargetException:java.lang.IllegalStateException:U无法找到 d 的注册商 -> [帮助 1]

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

解决方案

发生此错误是由于 TextIO#from("path_to_file") 方法不支持 Windows 文件系统路径.例如下面的代码抛出IllegalStateException:

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

<块引用>

线程main"中的异常org.apache.beam.sdk.Pipeline$PipelineExecutionException:java.lang.IllegalStateException:无法找到 d 的注册商

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

Trying to run WordCount example of Apache Beam (version 2.0.0) by first running

$ 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

then running

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

and getting the following error

[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]

However, if I run the same project downloaded and built in Mar 2017 (Beam v0.6.0), everything works fine. I just wonder what update of the Beam release causes this error.

解决方案

This error happens due to TextIO#from("path_to_file") method doesn't support Windows file system paths. For example the following code throws 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

I hope that Apache Beam team will fix it in near future...

这篇关于Apache 光束 WordCount 在 Windows 中运行错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆