spring - dozer : java.lang.reflect.InaccessibleObjectException - Stack Overflow

I use the lib doze-core (7.0.0) to map classes that have some fields of type javax.xml.datatype.XMLGreg

I use the lib doze-core (7.0.0) to map classes that have some fields of type javax.xml.datatype.XMLGregorianCalendar.

the map from my entity to class1 --> the type of filed in my object is com.sun.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl

and for the map from classe1 to class2, I have the error :

Source parent class: class1
  Source field name: dateModification
  Source field type: class com.sun.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
  Source field value: 2025-02-05T13:25:06.000Z
  Dest parent class: class2
  Dest field name: dateModification
  Dest field type: javax.xml.datatype.XMLGregorianCalendar
java.lang.reflect.InaccessibleObjectException: Unable to make public int com.sun.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.getYear() accessible: module java.xml does not "exports com.sun.apache.xerces.internal.jaxp.datatype" to unnamed module @624b0e1b
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:200)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:194)
    at com.github.dozermapper.core.util.ReflectionUtils.invoke(ReflectionUtils.java:348)

I have already this in jvm argument of apache tomcat 10 (jdk17)

--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.xml/com.sun.apache.xerces.internal.jaxp=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED

It works fine in jdk8/ tomcat8 with net.sf.dozer (5.5.1) as the class com.sun.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl was public in jdK8 as I read.

How can I correct this error ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744750032a4591540.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信