orika-mapper/orika

not support jdk17?

funky-eyes opened this issue · 9 comments

Exception in thread "main" java.lang.ExceptionInInitializerError
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 @396f6598
	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 ma.glasnost.orika.impl.DefaultMapperFactory.getMapperFacade(DefaultMapperFactory.java:881)

Process finished with exit code 1

Hi @a364176773 , Sadly same issue was open in 2021 and Orika hasn't response for that
u can see there is workaround in that discussion , #377

@a364176773 There is a work around:

  • Just add this jvm args, here is the code if you are using gradle
    bootRun { jvmArgs = ["--add-opens=java.base/java.lang=ALL-UNNAMED"] }

Sorry, I think this method is only a temporary solution, not a real support for jdk17

I agree @a364176773!

Looks like the authors gave up Orika, unfortunately.

Looking for replacements already, no new projects with Orika from now on.

@thiagolvlsantos we managed to replace Orika with https://mapstruct.org/ successfully. It was straight forward but that depends on the complexity of your mappings.

duplicate of #377

@Chr3is mapstruct is too cumbersome and requires defining conversion classes for each pair of POJOs

When using .parallelStream(), the orika maper is not working

ma.glasnost.orika.MappingException: ma.glasnost.orika.MappingException: While attempting the following mapping:
Error occurred: java.lang.ClassCastException:

Remove the following dependency solved this issue.

org.springframework.boot
spring-boot-devtools
true

but sometimes:
Caused by: java.lang.ClassNotFoundException: ma.glasnost.orika.impl.GeneratedMapperBase

@thiagolvlsantos we managed to replace Orika with https://mapstruct.org/ successfully. It was straight forward but that depends on the complexity of your mappings.

MapStruct always requires the writing of mappers.