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