question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to JAXB 2.3.1, avoid illegal access to internal APIs

See original GitHub issue

Running the Maven JAXB2 Plugin on Java 9 or later, leads to the following warning by the JVM:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/home/parlog/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.0/jaxb-runtime-2.3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
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

This happens because org.glassfish.jaxb : jaxb-runtime : 2.3.0 uses reflection to access ClassLoader::defineClass. This is allowed by default in Java 9 (although it leads to a warning), but could be denied by default as early as in Java 11 (although I consider that to be unlikely).

I assume there isn’t much Maven-JAXB2-Plugin can do about this except to track that dependency and update as soon as possible. Or could there be an alternative implementation that doesn’t need ClassLoader::defineClass?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
krys86commented, May 11, 2020

Hello, there is no 0.14.1 version in maven central and the warnings are still present.

The 0.14.0 version of “maven-jaxb2-plugin” is based on a parent project that still use the jaxb 2.3.0 version.

Would it be possible to fix it please?

Java version : AdoptOpenJDK (build 11.0.5+10)

BR Cristiano

4reactions
lexsotocommented, Feb 24, 2020

I see this ticket is closed, but was a fix released? I can’t find version 0.14.1 in Maven central and I am still getting the warnings with version 0.14.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proper fix for Java 10 complaining about illegal reflection ...
jaxb -ri runtime uses ClassLoader#defineClass / Unsafe#defineClass to do some bytecode modification in runtime to optimize performance.
Read more >
General considerations on updating Enterprise Java projects ...
Hence to avoid it, internal APIs in JDK 9 are inaccessible at compile ... Hence JVM has an argument called illegal-access to allow...
Read more >
JAXB Users Guide - Java EE
This document explains various interesting/complex/tricky aspects of JAXB, based on questions posted on the JAXB users forum and answers I provided.
Read more >
Implementation of JAXB-API has not been found on module ...
The JAXB packages javax.xml.* are not visible in Java 9 and Java 10 and removed in Java 11. And the jaxb-api contains only...
Read more >
Using JAXB in Java 11 | Dariawan
In Java 11, JAXB has been removed from JDK (together with other JEE related modules based on JEP 320) and we need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found