在eclipse中运行WordCount示例时的Apache-Beam异常

时间:2016-10-27 13:08:17

标签: apache-beam

使用

在eclipse中下载maven dependecies
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-direct-java</artifactId>
<version>0.2.0-incubating</version></dependency>

在将gs路径更改为C://examples//misc.txt后,下载并运行WordCount示例。获取以下异常。我没有通过任何运行器。如何传递runner选项并且从eclipse运行时输出参数?

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.IllegalStateException: Failed to validate C://examples//misc.txt
    at org.apache.beam.sdk.io.TextIO$Read$Bound.apply(TextIO.java:288)
    at org.apache.beam.sdk.io.TextIO$Read$Bound.apply(TextIO.java:195)
    at org.apache.beam.sdk.runners.PipelineRunner.apply(PipelineRunner.java:76)
    at org.apache.beam.runners.direct.DirectRunner.apply(DirectRunner.java:205)
    at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:401)
    at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:324)
    at org.apache.beam.sdk.values.PBegin.apply(PBegin.java:59)
    at org.apache.beam.sdk.Pipeline.apply(Pipeline.java:174)
    at org.apache.beam.examples.WordCount.main(WordCount.java:206)
Caused by: java.io.IOException: Unable to find handler for C://examples//misc.txt
    at org.apache.beam.sdk.util.IOChannelUtils.getFactory(IOChannelUtils.java:188)
    at org.apache.beam.sdk.io.TextIO$Read$Bound.apply(TextIO.java:283)
    ... 8 more

1 个答案:

答案 0 :(得分:0)

我相信Apache Beam将解析类似于C://directory/file的语法http://domain/file - 它会认为C是一个协议名称,directory是一个域。内部异常是说C是一个未知的协议。

在引用本地文件时,请尽量避免使用://符号。我建议使用常规Windows标准:C:\directory\file