Maven 3.6.3-1 fails to run with OpenJDK 17

Bug #1930541 reported by Manuel J.
84
This bug affects 17 people
Affects Status Importance Assigned to Milestone
guice (Ubuntu)
Confirmed
Undecided
Unassigned
maven (Debian)
Fix Released
Unknown
maven (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

[Impact]
Maven 3.6.3-1 apparently fails to run with OpenJDK 16 and 17. It seems to be a bug and was fixed in Maven 3.6.3-2 (and above) according to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980467.

[Test Plan]
For the version in the release pocket and the version in the proposed pocket, use maven to compile https://github.com/socialsoftware/quizzes-tutor:
$ sudo apt install openjdk-17-jdk maven=$VERSION
$ git clone https://github.com/socialsoftware/quizzes-tutor.git
$ cd quizzes-tutor
$ cd backend
$ mvn clean compile

This should fail for the version in the release pocket, with the error below, and succeed for the version in the proposed pocket.

[Where problems could occur]
Maven could fail to run on OpenJDK 11 or older.

[Original Description]
*System info*:
```
$ lsb_release -rd
Description: Ubuntu 20.04.2 LTS
Release: 20.04

$ apt-cache policy maven
maven:
  Installed: 3.6.3-1
  Candidate: 3.6.3-1
  Version table:
 *** 3.6.3-1 500
        500 http://ch.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://ch.archive.ubuntu.com/ubuntu focal/universe i386 Packages
        100 /var/lib/dpkg/status

$ apt-cache policy openjdk-16-jdk
openjdk-16-jdk:
  Installed: 16.0.1+9-1~20.04
  Candidate: 16.0.1+9-1~20.04
  Version table:
 *** 16.0.1+9-1~20.04 500
        500 http://ch.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages
        500 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
```

*Summary*
Maven 3.6.3-1 apparently fails to run with OpenJDK 16. It seems to be a bug and was fixed in Maven 3.6.3-2 (and above) according to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980467.

*Expected behaviour*
I expect to be able to use maven with all currently supported General Availability Java versions.

*Observed behaviour*
I installed OpenJDK 16 (via PPA, see version above) and tried to compile a Maven project, producing the following output:
```
$ mvn compile
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper

$ echo $?
1
```

Thanks and kind regards,
-Manu

Tags: fr-5268
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in maven (Ubuntu):
status: New → Confirmed
Revision history for this message
John Neffenger (jgneff) wrote :

Now that Ubuntu 20.04 LTS provides the OpenJDK 16 package in the updates pocket (since May 10, 2021), it would be great to have the fix in Ubuntu Maven 3.6.3-2 back-ported to Ubuntu 20.04. I'm working around the problem by installing a local copy of Maven 3.8.1 directly from Apache.

$ apt-cache policy openjdk-16-jdk
openjdk-16-jdk:
  Installed: 16.0.1+9-1~20.04
  Candidate: 16.0.1+9-1~20.04
  Version table:
 *** 16.0.1+9-1~20.04 500
        500 http://ca.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages
        100 /var/lib/dpkg/status

Without the fix, installing OpenJDK 16 breaks Maven.

Revision history for this message
clerum (cody-lerum) wrote :

This is a blocker for using JDK 16 (release 16 March 2021) along with Maven on 20.04.

This will also be a blocker for the next LTS Java 17 release in September 2021

Revision history for this message
clerum (cody-lerum) wrote :

Is there any assistance I can provide to move this forward?

Revision history for this message
Rural Hunter (ruralhunter) wrote :

Please fix it ASAP!

Revision history for this message
mjw99 (mark-williamson) wrote :

This might be a solution from the Debian folk:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948310

summary: - Maven 3.6.3-1 fails to run with OpenJDK 16
+ Maven 3.6.3-1 fails to run with OpenJDK 16 and 17
Revision history for this message
Matthew Barry (komputerwiz) wrote : Re: Maven 3.6.3-1 fails to run with OpenJDK 16 and 17

The upstream fix from Debian requires guice >=4.2.3 and, implicitly, a newer version of guava (Debian repo has 29.0). The current available versions in Ubuntu 20.04 are guice 4.2.1 and guava 19.0, so both of these package updates will have to be backported.

Attempting to build maven 3.6.3 with the changes described by the commit in the upstream bug report (https://salsa.debian.org/java-team/maven/-/commit/48fb5b2ae0dcd860d61e4b258d60fcee03d2713c) resulted in maven packages that were missing some required "Depends" declarations, for example libcommons-cli-java and libgeronimo-annotation-1.3-spec-java. These are listed as "Build-Depends" and installing them does allow maven to run on Java 16+.

Hopefully there is some useful info here for the maintainers.

Revision history for this message
Wim (wvdgraaf) wrote :

Can we expect a fix? Java 17 is a LTS release, so a working version of Maven would be very helpful. Or do we have to wait half a year for Ubuntu 22.04 to arrive? Thanks!

Revision history for this message
Gavriel Fleischer (flocsy) wrote :

Any update on this? Do I have to upgrade to Ubuntu 22.04 or is there hope for a fix in Ubuntu 20.04?

Revision history for this message
Tom Misilo (tmisilo) wrote :

Just updating that is is still an issue in 2023, with 20.04.6

Changed in guice (Ubuntu):
status: New → Confirmed
summary: - Maven 3.6.3-1 fails to run with OpenJDK 16 and 17
+ [SRU] Maven 3.6.3-1 fails to run with OpenJDK 17
description: updated
Changed in maven (Debian):
status: Unknown → Fix Released
Revision history for this message
Luís Infante da Câmara (luis220413) wrote : Re: [SRU] Maven 3.6.3-1 fails to run with OpenJDK 17
Revision history for this message
Luís Infante da Câmara (luis220413) wrote (last edit ):

The debdiffs for Maven and maven-resolver are in bug #1922654.

summary: - [SRU] Maven 3.6.3-1 fails to run with OpenJDK 17
+ Maven 3.6.3-1 fails to run with OpenJDK 17
Vladimir Petko (vpa1977)
tags: added: fr-5268
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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