domingo, 6 de marzo de 2022

martes, 1 de marzo de 2022

La API de JPA 2.1 (X). Java 17 problems. Jaxb-runtime dependency needed

 As stated in stack overflow (https://stackoverflow.com/a/70472102/7704658) A depenendency is needed

Here is the error


java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)


When using Hibernate, this dependency in gradle should be added 

implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.2'    



Here is an example with hibernate (in the dependencies section)

    
/* HIbernate */    
implementation "org.hibernate:hibernate-core-jakarta:5.6.5.Final"
implementation "org.hibernate:hibernate-envers-jakarta:5.6.5.Final"
implementation "org.hibernate:hibernate-validator:7.0.2.Final" 
    
//Jaxb Needed in java 17 @see https://stackoverflow.com/a/70472102
implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.2'