beam icon indicating copy to clipboard operation
beam copied to clipboard

[Bug]: [Java/YAML] StringCompiler fails to resolve org.apache.beam.sdk.values.Row inside Java SDK harness container

Open jk-shah opened this issue 3 weeks ago • 0 comments

What happened?

In Beam YAML, when a Filter with language: generic (or language: java) immediately follows a Java cross-language source such as ReadFromKafka, Beam YAML's provider affinity selects JavaFilterTransformProvider so the filter can fuse into the Java environment.

Pipeline expansion succeeds, but at runtime inside the apache/beam_java*_sdk container (FnHarness), StringCompiler fails to compile the generated Eval class with CompileException: package org.apache.beam.sdk.values does not exist / cannot find symbol: class Row.

Minimal Beam YAML reproducer (against any Kafka broker on PrismRunner / portable runner):

pipeline:
  type: chain
  transforms:
    - type: ReadFromKafka
      config:
        bootstrap_servers: "localhost:9092"
        topic: "events"
        format: "JSON"
        schema:
          type: object
          properties:
            amount: {type: number}
    - type: Filter
      config:
        language: generic
        keep: "amount > 10"
    - type: WriteToJson
      config:
        path: "/tmp/out.json"

Cause In sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/providers/StringCompiler.java (lines 59–87), classpathSupplier constructs the -classpath passed to ToolProvider.getSystemJavaCompiler() from System.getProperty("java.class.path") and if (cl instanceof URLClassLoader):

On JDK 11+ (all supported Beam Java containers), the application classloader is BuiltinClassLoader, not URLClassLoader. Inside the portable Java SDK harness container (FnHarness), worker-staged pipeline JARs (including beam-sdks-java-core containing org.apache.beam.sdk.values.Row) are not on the boot launcher's initial java.class.path or are loaded dynamically. As a result, javac cannot see org.apache.beam.sdk.values.Row even though Row.class is already loaded in the JVM. Including Row.class.getProtectionDomain().getCodeSource().getLocation() (and staged artifact JAR paths from the harness directory / classloader resources) in classpathSupplier allows javac to resolve Row inside the SDK harness container.

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • [ ] Component: Python SDK
  • [x] Component: Java SDK
  • [ ] Component: Go SDK
  • [ ] Component: Typescript SDK
  • [ ] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Infrastructure
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [ ] Component: Prism Runner
  • [ ] Component: Hazelcast Jet Runner
  • [ ] Component: Google Cloud Dataflow Runner

jk-shah avatar Nov 08 '26 06:11 jk-shah