Sqoop jobs fail with unnamed module exception after JDK 17 upgrade
After upgrading to JDK 17, Sqoop jobs may fail due to strict enforcement of the Java Platform Module System (JPMS).
Condition
After upgrading to Cloudera Runtime 7.1.9 SP1 (or later) cluster to JDK 17, Sqoop jobs that previously worked on JDK 8 or JDK 11 begin to fail.
The failures can impact both Sqoop import and export jobs and might disrupt critical workflows.
Depending on the job type, the YARN application logs may show one or more of the following errors:
IllegalAccessErrorInaccessibleObjectException- Module access errors involving an unnamed module
- Failures referencing restricted Java packages such as:
- java.lang
- java.net
- sun.net.dns
- sun.net.util
- com.sun.jmx.mbeanserver
In some cases:
- Sqoop import jobs fail immediately after the JDK 17 upgrade.
- Sqoop export jobs continue to fail even after the YARN Application Master JVM options are configured.
Cause
JDK 17 strictly enforces the Java Platform Module System (JPMS), which restricts access to internal JDK APIs that Sqoop and the underlying MapReduce framework rely on.
Sqoop was originally built for earlier Java versions and uses reflection to access these internal APIs. Under JDK 17, this access is blocked unless explicitly allowed using JVM options such as --add-opens and --add-exports.
Additionally:
- YARN Application Master JVM options (
yarn.app.mapreduce.am.command-opts) do not automatically propagate to MapReduce task JVMs. - For Sqoop export jobs, the map task JVM requires additional module access (for example,
java.net) to interact with external databases. - The YARN configuration Add add-opens flags to MR containers is disabled by default, regardless of the JDK or Cloudera version. When using JDK 17, required module flags must be explicitly provided to the relevant JVMs.
As a result, the import jobs fail due to restricted module access in the Application Master, and export jobs fail because the map task JVM does not receive all required module permissions.
