Ace McCloud
Ace McCloud

Reputation: 900

Apache flink job crashes with exception java.lang.IllegalAccessError: class org.apache.flink.util.NetUtils on start_cluster

Just downloaded Flink 1.13.1 and wanted to run a small local test project. My java version is:

pneelaka@MacBook-Pro Apache %
pneelaka@MacBook-Pro Apache % $FLINK_HOME/bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host MacBook-Pro.
Starting taskexecutor daemon on host MacBook-Pro.
pneelaka@MacBook-Pro Apache %

The UI at localhost:8081 does not launch. I see the following in my logs:

java.lang.IllegalAccessError: class org.apache.flink.util.NetUtils (in unnamed module @0x76e041cf) cannot access class sun.net.util.IPAddressUtil (in module java.base) because module java.base does not export sun.net.util to unnamed module @0x76e041cf
    at org.apache.flink.util.NetUtils.unresolvedHostToNormalizedString(NetUtils.java:169) ~[flink-dist_2.12-1.13.1.jar:1.13.1]
    at org.apache.flink.util.NetUtils.unresolvedHostAndPortToNormalizedString(NetUtils.java:197) ~[flink-dist_2.12-1.13.1.jar:1.13.1]
    at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils.getRpcUrl(AkkaRpcServiceUtils.java:173) ~[flink-dist_2.12-1.13.1.jar:1.13.1]
    at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils.getRpcUrl(AkkaRpcServiceUtils.java:138) ~[flink-dist_2.12-1.13.

This heavily seems to be a java version issue ? But wouldn't flink be comptable with latest java? Will I have to go back Java 11 or 8 as it says here: https://ci.apache.org/projects/flink/flink-docs-release-1.13//docs/try-flink/local_installation/#step-1-download

Any suggestions? I have other java versions but my java home points to the latest i.e 16:

pneelaka@MacBook-Pro Apache % /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
    16.0.1, x86_64: "OpenJDK 16.0.1"    /Users/pneelaka/Library/Java/JavaVirtualMachines/openjdk-16.0.1/Contents/Home
    16.0.1, x86_64: "Java SE 16.0.1"    /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home
    14.0.2, x86_64: "OpenJDK 14.0.2"    /Users/pneelaka/Library/Java/JavaVirtualMachines/adopt-openjdk-14.0.2/Contents/Home
    11.0.11.1, x86_64:  "Amazon Corretto 11"    /Users/pneelaka/Library/Java/JavaVirtualMachines/corretto-11.0.11/Contents/Home
    1.8.0_292, x86_64:  "Amazon Corretto 8" /Users/pneelaka/Library/Java/JavaVirtualMachines/corretto-1.8.0_292/Contents/Home

UPDATE : Set my java home to point to java 11.0 using

export JAVA_HOME=/usr/libexec/java_home -v 11.0

and it worked

Upvotes: 2

Views: 2918

Answers (3)

BBQ
BBQ

Reputation: 35

Flink runs on JVM from v1.8 up to v11 but not on the later ones. The official manual is misleading "Java 1.8.x or higher..."

If you use a package manager (yum, dnf, apt, etc.) then it's enough just make a clean install of java-1.8.0-openjdk and java-1.8.0-openjdk-devel. You won't need to export any environmental variables. But do not forget to remove any newer/older java versions.

If you have multiple Java versions or if you installed java manually, do:

export JAVA_HOME=/usr/libexec/java_home -v 1.8.0

or whatever your java path is. You might also need to set paths for JRE_HOME

Upvotes: 3

kkrugler
kkrugler

Reputation: 9245

Uhm, yes - if the question is whether the Flink documentation is correct, then I believe the answer is yes. From the page you referenced in your question:

To be able to run Flink, the only requirement is to have a working Java 8 or 11 installation

Upvotes: 0

Ace McCloud
Ace McCloud

Reputation: 900

Set my java home to point to java 11.0 using

export JAVA_HOME=/usr/libexec/java_home -v 11.0

Flink runs with 1.8 or 11 but not the later ones

Upvotes: 3

Related Questions