Skip to content

Commit f264257

Browse files
committed
[IcebergIO] Run xlang wrapper validation expansion service on Java 17
The cross-language wrapper validation launches the io expansion-service jar from Python via JAVA_HOME. That jar bundles IcebergIO, now Java 17 bytecode, so launching it on the default Java 11 fails with UnsupportedClassVersionError. createCrossLanguageUsingJavaExpansionTask was missing the JAVA_HOME redirect that #38974 added to the other cross-language task factories. Add it, defaulting to java17Home (already provided to this build) so bundled Java 17 IOs can be loaded.
1 parent b15292c commit f264257

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,12 @@ class BeamModulePlugin implements Plugin<Project> {
27152715
def usesDataflowRunner = config.pythonPipelineOptions.contains("--runner=TestDataflowRunner") || config.pythonPipelineOptions.contains("--runner=DataflowRunner")
27162716
String ver = project.findProperty('testJavaVersion')
27172717
def javaContainerSuffix = ver ? getSupportedJavaVersion(ver) : getSupportedJavaVersion()
2718+
// Resolve the JDK used to launch the Python-started expansion service (see the exec block
2719+
// below). Prefer the explicitly requested test JDK (-PtestJavaVersion); otherwise fall back
2720+
// to java17Home when provided. Some bundled IOs (e.g. IcebergIO) are compiled for Java 17, so
2721+
// the expansion service must run on a JDK that can load them.
2722+
String testJavaHome = ver ? project.findProperty("java${ver}Home") : null
2723+
String expansionServiceJavaHome = testJavaHome ?: project.findProperty('java17Home')
27182724

27192725
// Sets up, collects, and runs Python pipeline tests
27202726
project.tasks.register(config.name+"PythonUsingJava") {
@@ -2744,6 +2750,12 @@ class BeamModulePlugin implements Plugin<Project> {
27442750
project.exec {
27452751
// environment variable to indicate that jars have been built
27462752
environment "EXPANSION_JARS", config.expansionProjectPaths
2753+
// Launch the expansion service on expansionServiceJavaHome when resolved, so that
2754+
// bundled Java 17 IOs (e.g. IcebergIO) can be loaded. The other cross-language task
2755+
// factories apply the same JAVA_HOME redirect.
2756+
if (expansionServiceJavaHome) {
2757+
environment "JAVA_HOME", expansionServiceJavaHome
2758+
}
27472759
String additionalDependencyCmd = ""
27482760
if (config.additionalDeps != null && !config.additionalDeps.isEmpty()){
27492761
additionalDependencyCmd = "&& pip install ${config.additionalDeps.join(' ')} "

0 commit comments

Comments
 (0)