Apache beam WordCount running error in windows

纵然是瞬间 提交于 2019-12-12 16:56:40

问题


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.


回答1:


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...




回答2:


This error seems to indicate you are trying to access a file with invalid scheme. It comes from here: FileSystems.java

It may be an issue with your OS.

Can you provide information about your OS and dev environment?

EDIT: Since you're using Windows as you say and as MeetJoeBlack explains - my first assumption was probably correct.

I suggest you try to run the code via Docker using this Maven Docker Image

You can read the howto in there - If you need more help just ping me.



来源:https://stackoverflow.com/questions/44147535/apache-beam-wordcount-running-error-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!