jk-shah opened a new issue, #41079:
URL: https://github.com/apache/beam/issues/41079
### 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):
```yaml
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]