gradle: "illegal reflective access" with openjdk-9

Bug #1760359 reported by Andreas Schildbach
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gradle (Ubuntu)
Fix Released
Medium
Tiago Stürmer Daitx

Bug Description

Since a couple of days, gradle doesn't work on Ubuntu 18.04 LTS any more on openjdk8. Installing openjdk9 kind of works around this problem, but it throws a couple of scary illegal access warnings instead. Just a days ago, everything worked fine so there must have been some bug introduced into a dependent package.

$ gradle -S
Starting a Gradle Daemon, 8 busy and 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
        at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.<init>(SocketConnection.java:154)
        at org.gradle.internal.remote.internal.inet.SocketConnection.<init>(SocketConnection.java:59)
        at org.gradle.internal.remote.internal.inet.SocketConnectCompletion.create(SocketConnectCompletion.java:39)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToDaemon(DefaultDaemonConnector.java:255)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToDaemonWithId(DefaultDaemonConnector.java:241)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:213)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:130)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:127)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:81)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:244)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:217)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:210)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gradle 3.4.1-4
ProcVersionSignature: Ubuntu 4.15.0-13.14-generic 4.15.10
Uname: Linux 4.15.0-13-generic x86_64
ApportVersion: 2.20.9-0ubuntu2
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sun Apr 1 00:04:40 2018
InstallationDate: Installed on 2013-01-11 (1905 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gradle
UpgradeStatus: Upgraded to bionic on 2018-03-07 (24 days ago)

Revision history for this message
Andreas Schildbach (schildbach) wrote :
Revision history for this message
Andreas Schildbach (schildbach) wrote :

I think the issue that Gradle has been updated to the Debian experimental version 3.4.1. Before, it was synched to "unstable" 3.2.1.

Revision history for this message
Steve Langasek (vorlon) wrote :

openjdk-8 will not be supported in 18.04, as discussed in <https://lists.ubuntu.com/archives/ubuntu-release/2018-February/004275.html>, <https://lists.ubuntu.com/archives/ubuntu-release/2018-March/004359.html>. The java-common package points to openjdk-9 today, and while openjdk-8 will be retained in universe for 18.04 for compatibility, there is no committment that any other particular package will remain compatible with openjdk-8.

What are the "scary illegal access warnings" that you see with openjdk-9?

Changed in gradle (Ubuntu):
status: New → Incomplete
Revision history for this message
Andreas Schildbach (schildbach) wrote :

Thanks Steve for the clarification. I personally feel the (forced) move to Java9 comes too early, as I
just have moved my Android projects to Java8 with quite some headache. But I guess I have to adapt.

Here is the output of gradle under openjdk-9. The first 5 lines are always the same regardless of the parameters.

$ gradle
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/usr/share/gradle/lib/gradle-base-services-3.4.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
:help

Welcome to Gradle 3.4.1.

To run a build, run gradle <task> ...

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

To see more detail about a task, run gradle help --task <task>

BUILD SUCCESSFUL

Total time: 1.105 secs

Revision history for this message
Steve Langasek (vorlon) wrote :

Thanks. That definitely looks like something we should be fixing for 18.04.

summary: - Regression: java.lang.NoSuchMethodError:
- java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
+ gradle: "illegal reflective access" with openjdk-9
Changed in gradle (Ubuntu):
assignee: nobody → Tiago Stürmer Daitx (tdaitx)
status: Incomplete → Triaged
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gradle - 3.4.1-6

---------------
gradle (3.4.1-6) unstable; urgency=medium

  * Team upload.
  * Improved the Java 8 compatibility patch

 -- Emmanuel Bourg <email address hidden> Thu, 05 Apr 2018 08:39:52 +0200

Changed in gradle (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.