简体   繁体   English

org.apache.beam.sdk.util.UserCodeException 使用 Samza Runner 执行 Beam Pipeline

[英]org.apache.beam.sdk.util.UserCodeException while executing Beam Pipeline using the Samza Runner

I am trying to run the Wordcount Demo from here with the Samza Runner.我正在尝试使用 Samza Runner 从此处运行 Wordcount 演示。 This is my build.gradle这是我的 build.gradle

plugins {
  id 'eclipse'
  id 'java'
  id 'application'

  // 'shadow' allows us to embed all the dependencies into a fat jar.
  id 'com.github.johnrengelman.shadow' version '4.0.3'
}

mainClassName = 'samples.quickstart.WordCount'

maven {
        url = uri('http://packages.confluent.io/maven/')
    }
  mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

ext.apacheBeamVersion = '2.22.0'

dependencies {
  shadow "org.apache.beam:beam-sdks-java-core:$apacheBeamVersion"
    
  runtime "org.apache.beam:beam-runners-direct-java:$apacheBeamVersion"
  runtime "org.slf4j:slf4j-api:1.+"
  runtime "org.slf4j:slf4j-jdk14:1.+"
  compile group: 'org.apache.beam', name: 'beam-runners-samza', version: '2.22.0'
compile group: 'org.apache.samza', name: 'samza-api', version: '1.4.0'
  compile group: 'org.apache.samza', name: 'samza-core_2.11', version: '1.4.0'
  compile group: 'org.apache.samza', name: 'samza-kafka_2.11', version: '1.4.0'
  compile group: 'org.apache.samza', name: 'samza-kv_2.11', version: '1.4.0'
  compile group: 'org.apache.samza', name: 'samza-kv-rocksdb_2.11', version: '1.4.0'
  testCompile "junit:junit:4.+"
}
shadowJar {
  zip64 true
  baseName = 'WordCount'  // Name of the fat jar file.
  classifier = null       // Set to null, otherwise 'shadow' appends a '-all' to the jar file name.
  manifest {
    attributes('Main-Class': mainClassName)  // Specify where the main class resides.
  }
} 

My wordcount.java is as follows.我的 wordcount.java 如下。

package samples.quickstart;

import org.apache.beam.runners.samza.SamzaRunner;
//import org.apache.beam.sdk.io.kafka.KafkaIO;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.io.TextIO;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.transforms.Count;
import org.apache.beam.sdk.transforms.Filter;
import org.apache.beam.sdk.transforms.FlatMapElements;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.TypeDescriptors;
import java.util.Arrays;

public class WordCount {
    
    private static final String jobName = "beamtest";
    
  public static void main(String[] args) {
    String inputsDir = "data/*";
    String outputsPrefix = "outputs/part";

    PipelineOptions options = PipelineOptionsFactory.fromArgs(args).create();
    options.setRunner(SamzaRunner.class);

    Pipeline pipeline = Pipeline.create(options);
    
    pipeline
        .apply("Read lines", TextIO.read().from(inputsDir))
        .apply("Find words", FlatMapElements.into(TypeDescriptors.strings())
            .via((String line) -> Arrays.asList(line.split("[^\\p{L}]+"))))
        .apply("Filter empty words", Filter.by((String word) -> !word.isEmpty()))
        .apply("Count words", Count.perElement())
        .apply("Write results", MapElements.into(TypeDescriptors.strings())
            .via((KV<String, Long> wordCount) ->
                  wordCount.getKey() + ": " + wordCount.getValue()))
        .apply(TextIO.write().to(outputsPrefix));
    pipeline.run().waitUntilFinish();
  }
} 


I am using Beam Version 2.22.0.我正在使用 Beam 版本 2.22.0。 I tried the following Combinations.我尝试了以下组合。 Samza 1.4 with Beam 2.22, Samza 1.0 with Beam 2.11 and Beam 2.22 and Samza 0.14.1 with Beam 2.11.0.带有 Beam 2.22 的 Samza 1.4、带有 Beam 2.11 和 Beam 2.22 的 Samza 1.0 以及带有 Beam 2.11.0 的 Samza 0.14.1。 However while executing i get the following error:但是,在执行时我收到以下错误:

java.lang.IncompatibleClassChangeError: Method 'void org.apache.samza.storage.kv.KeyValueStore.deleteAll(java.util.List)' must be InterfaceMethodref constant

I am using Java 1.8.我正在使用 Java 1.8。 Does anybody have an Idea what causes this Problem?有没有人知道是什么导致了这个问题?

may you paste the build.gradle and modified wordcount.java using Samza runner here, so that we can have an investigation on whether it is incompatibility issue or configuration issue.可以把 build.gradle 和修改后的 wordcount.java 用 Samza runner 贴在这里,这样我们可以排查一下是不兼容问题还是配置问题。 Thanks for having a try over Samza runner!感谢您试用 Samza 跑步者!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 java 的 apache 光束管道配置火花流道 - How to configure spark runner for apache beam pipeline for java Flink runner 上的 Beam:ClassNotFoundException:org.apache.beam.runners.flink.translation.wrappers.streaming.WorkItemKeySelector - Beam on Flink runner: ClassNotFoundException: org.apache.beam.runners.flink.translation.wrappers.streaming.WorkItemKeySelector Apache Beam与数据流运行器中的聚合器 - Aggregators in Apache beam with dataflow runner Apache Beam-跳过管道步骤 - Apache Beam - skip pipeline step 有没有办法在不使用管道的情况下检查Apache Beam sdk中是否存在文件 - Is there any way to check if file exists in Apache beam sdk without using pipeline Apache Beam - 在管道中添加延迟 - Apache Beam - adding a delay into a pipeline Apache Beam:未指定运行器,并且在类路径中未找到DirectRunner - Apache beam: No Runner was specified and the DirectRunner was not found on the classpath 在Eclipse上使用Dataflow Runner的Apache Beam MinimalWordcount示例 - Apache Beam MinimalWordcount example with Dataflow Runner on eclipse Java:使用 apache 光束管道读取存储在存储桶中的 excel 文件 - Java: read excel file stored in a bucket using apache beam pipeline 带有数据流的 Apache Beam Go SDK - Apache Beam Go SDK with Dataflow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM