Upgrade to JAXB 2.3.1, avoid illegal access to internal APIs
See original GitHub issueRunning 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:
- Created 5 years ago
- Comments:15 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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