Hibernate java 10

前端 未结 1 591
北海茫月
北海茫月 2021-01-19 05:47

I migrated my application from java 8 to java 10. But now I see the following exception when try to store something in a database

Caused by: javax.persisten         


        
相关标签:
1条回答
  • 2021-01-19 06:30

    This is the root cause

    Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private jdk.internal.reflect.ConstructorAccessorImpl jdk.internal.reflect.DelegatingConstructorAccessorImpl.delegate accessible: module java.base does not "opens jdk.internal.reflect" to unnamed module @55283c54
    

    Java 10 has concept of modules and first of all public is not "that" public anymore and reflection is also not that powerful.

    You could use JVM flag as suggested by @RobertHume but in fact you need to migrate to a newer Hibernate version that supports Java9/10 (if any).

    Also check this link https://www.sitepoint.com/reflection-vs-encapsulation-in-the-java-module-system/#commandlineescapehatches for more details regarding suggested JVM flag

    0 讨论(0)
提交回复
热议问题