orika: Problems with Java 17
So I tried my code with Java 17 and I get this exception:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @46d21ee0
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:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at ma.glasnost.orika.converter.builtin.CloneableConverter.<init>(CloneableConverter.java:64)
at ma.glasnost.orika.converter.builtin.CloneableConverter$Builtin.<init>(CloneableConverter.java:221)
at ma.glasnost.orika.converter.builtin.BuiltinConverters.register(BuiltinConverters.java:135)
at ma.glasnost.orika.impl.DefaultMapperFactory.build(DefaultMapperFactory.java:1278)
at io.nemesis.platform.core.mapper.MixinAwareMapperFactory.build(MixinAwareMapperFactory.java:160)
at ma.glasnost.orika.impl.DefaultMapperFactory.getMapperFacade(DefaultMapperFactory.java:881)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 31
- Comments: 20
Encountered the same issue, as a workaround you can set the following VM option
–add-opens java.base/java.lang=ALL-UNNAMED
Hi, any news here? People are still waiting for this.
Any plans on releasing 1.6.0? We use this library extensively and although the workaround is fine its not ideal.
Hi Team, Any update on new version of orika core which is compatible with JDK17. I am facing same issue.
@elaatifi should we consider this project dead?
Unfortunately, no. I have been following Orika Mapper since the start of 2022. There are no updates rolling out. For the time being, as a workaround we used the following flag as VM Option –add-opens java.base/java.lang=ALL-UNNAMED But we conducted a research and found Mapstruct to be the closest best alternative to Orika. I would suggest everyone to consider migrating to another Mapper.
Seems that this will be fixed in the 1.6.0 version. I’m waiting for that to release.
For those using the Gradle JIB-Plugin, solved it as follows:
Hello
We are using a workaround since last year in order to migrate on jdk17 without --add-opens, this allow the depreciation of Orika without rushing because of jdk17, off course “use it with caution”
The workaround is :
snippets :
see https://github.com/orika-mapper/orika/blob/master/core/src/main/java/ma/glasnost/orika/converter/builtin/BuiltinConverters.java#L77 do not use makeSimpleConverter and rewrite them without reflection if needed (Date is on of them) .
okay, seems to be dead. one year later, the 1.6.0 is not yet released. I’ll go for another mapper-option. schade.
after set this ,not good
+1 saw this with eclipse adoptium 17.0.1.12-hotspot. Reverted to openjdk11 and all was fine.