Proper fix for Java 10 complaining about illegal reflection access by jaxb-impl 2.3.0?

前端 未结 3 831
无人共我
无人共我 2020-12-13 06:42

We are looking at upgrading some legacy code to Java 10. As JAXB is not visible by default (EDIT: and the proper long term solution is not to circumvent the sympto

3条回答
  •  一生所求
    2020-12-13 07:26

    jaxb-ri runtime uses ClassLoader#defineClass / Unsafe#defineClass to do some bytecode modification in runtime to optimize performance. ClassLoader#defineClass is tried first which causes the warning.

    This legacy optimization is removed completely in jaxb-ri master (after 2.3.0, not released yet).

    To disable this optimization for 2.3.0, set system property com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize.

    After next jaxb-ri release updating to newest version will remove the warning. jaxb-core artifact will be discontinued in favor for JPMS support. Correct pom will look like:

    
        javax.xml.bind
        jaxb-api
        2.4.0 
    
    
        org.glassfish.jaxb
        jaxb-runtime
        2.4.0 
    
    

    If you wish to try early, you can pick latest promoted build from: https://maven.java.net/content/groups/promoted/org/glassfish/jaxb/jaxb-runtime/

提交回复
热议问题