Comments (20)
Encountered the same issue, as a workaround you can set the following VM option
--add-opens java.base/java.lang=ALL-UNNAMED
from orika.
Hi,
any news here?
People are still waiting for this.
from orika.
Any plans on releasing 1.6.0? We use this library extensively and although the workaround is fine its not ideal.
from orika.
Hi Team, Any update on new version of orika core which is compatible with JDK17. I am facing same issue.
from orika.
@elaatifi should we consider this project dead?
from orika.
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.
from orika.
Seems that this will be fixed in the 1.6.0 version. I'm waiting for that to release.
from orika.
For those using the Gradle JIB-Plugin, solved it as follows:
container {
jvmFlags = ['--add-opens=java.base/java.lang=ALL-UNNAMED', '-XX:+UseContainerSupport', '-XX:MaxRAMPercentage=75.0']
from orika.
+1 saw this with eclipse adoptium 17.0.1.12-hotspot. Reverted to openjdk11 and all was fine.
from orika.
遇到同样的问题,作为一种解决方法,您可以设置以下 VM 选项
--add-opens java.base/java.lang=ALL-UNNAMED
after set this ,not good
from orika.
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)
use below in your VM arg
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED
from orika.
okay, seems to be dead. one year later, the 1.6.0 is not yet released. I'll go for another mapper-option. schade.
from orika.
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 :
- switch from the default JavassistCompilerStrategy to EclipseJdtCompilerStrategy
- disable the default builtin converters
- add only jdk17 ready converters, and rewrite if not compatible
snippets :
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-eclipse-tools</artifactId>
<version>1.5.4</version>
</dependency>
@Deprecated(forRemoval = true)
public class BidouilleOrikaMapperFactory {
public static MapperFactory defaultMapperFactory() {
return new DefaultMapperFactory.Builder()
.useBuiltinConverters(false)
.converterFactory(new BidouilleOrikaConverterFactory())
.compilerStrategy(new BidouilleOrikaCompilerStrategy())
.build();
}
}
@Deprecated(forRemoval = true)
public class BidouilleOrikaCompilerStrategy extends EclipseJdtCompilerStrategy {
@Override
protected void writeSourceFile(String sourceText, String packageName, String className) throws IOException {
}
}
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) .
@Deprecated(forRemoval = true)
public class BidouilleOrikaConverterFactory extends DefaultConverterFactory {
public BidouilleOrikaConverterFactory() {
super();
this.registerConverter(new CopyByReferenceConverter());
this.registerConverter(new EnumConverter());
/*
* Register to/from string converters
*/
this.registerConverter(new FromStringConverter());
this.registerConverter(new ToStringConverter());
/*
* Register common date/time converters
*/
this.registerConverter(new DateAndTimeConverters.DateToXmlGregorianCalendarConverter());
this.registerConverter(new DateAndTimeConverters.DateToTimeConverter());
this.registerConverter(new DateAndTimeConverters.CalendarToXmlGregorianCalendarConverter());
this.registerConverter(new DateAndTimeConverters.XmlGregorianCalendarToTimestampConverter());
this.registerConverter(new DateAndTimeConverters.XmlGregorianCalendarToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.XmlGregorianCalendarToTimeConverter());
this.registerConverter(new DateAndTimeConverters.LongToXmlGregorianCalendarConverter());
this.registerConverter(new DateAndTimeConverters.DateToCalendarConverter());
this.registerConverter(new DateAndTimeConverters.CalendarToTimeConverter());
this.registerConverter(new DateAndTimeConverters.CalendarToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.LongToCalendarConverter());
this.registerConverter(new DateAndTimeConverters.TimestampToCalendarConverter());
this.registerConverter(new DateAndTimeConverters.DateToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.LongToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.TimeToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.TimestampToSqlDateConverter());
this.registerConverter(new DateAndTimeConverters.LongToTimeConverter());
this.registerConverter(new DateAndTimeConverters.TimestampToTimeConverter());
this.registerConverter(new DateAndTimeConverters.LongToTimestampConverter());
this.registerConverter(new DateAndTimeConverters.DateToTimestampConverter());
this.registerConverter(new DateAndTimeConverters.LongToDateConverter());
/*
* Register numeric type converter
*/
this.registerConverter(new NumericConverters.BigDecimalToDoubleConverter());
this.registerConverter(new NumericConverters.BigDecimalToFloatConverter());
this.registerConverter(new NumericConverters.BigIntegerToIntegerConverter(false));
this.registerConverter(new NumericConverters.BigIntegerToLongConverter(false));
this.registerConverter(new NumericConverters.IntegerToShortConverter(false));
this.registerConverter(new NumericConverters.LongToIntegerConverter(false));
this.registerConverter(new NumericConverters.LongToShortConverter(false));
this.registerConverter(new NumericConverters.FloatToShortConverter(false));
this.registerConverter(new NumericConverters.FloatToIntegerConverter(false));
this.registerConverter(new NumericConverters.FloatToLongConverter(false));
this.registerConverter(new NumericConverters.DoubleToShortConverter(false));
this.registerConverter(new NumericConverters.DoubleToIntegerConverter(false));
this.registerConverter(new NumericConverters.DoubleToLongConverter(false));
/*
* Register converter to instantiate by using a constructor on the
* destination which takes the source as argument
*/
this.registerConverter(new ConstructorConverter());
}
}
from orika.
Hi @oliverlockwood , you can see my comment from #372 . Unfortunately it seems dead to me for quite time. 😞
from orika.
I was upgrading an API to Java 17 when I faced exact same issue. In a desperate final attempt I changed the maven version from 3.3.9 to 3.8.5 and the error message changed to the following
"The dependencies of some of the beans in the application context form a cycle:"
I added @lazy annotation at one of the beans and now my API is working absolutely fine.
from orika.
Did you fix the issue? I'm still struggling with this issue... @wolfomat
from orika.
Does anyone have experience using Orika mapper and GraalVM native image?
Do you need to provide extra metadata for the classes that will be mapped at runtime?
from orika.
Any updates on the existing issue? We need a mapper that uses reflections as we need run time mapping based on versioning logic of ours. Any new project or libraries that can be used which handles Java 17 and Spring Boot 3.0.6 and is managed actively. Thanks!
from orika.
Any updates ???
from orika.
Hi I'm facing a similar issue using TMC Beans for the Helsinki MOOC in JAVA. How can I get to the VM Option to use the flag?
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 @3191379a
[java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)] [java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)] [java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)]
[java.lang.reflect.Method.setAccessible(Method.java:193)]
org.powermock.reflect.internal.WhiteboxImpl.doGetAllMethods(WhiteboxImpl.java:1499) org.powermock.reflect.internal.WhiteboxImpl.getAllMethods(WhiteboxImpl.java:1473) org.powermock.reflect.internal.WhiteboxImpl.findMethodOrThrowException(WhiteboxImpl.java:853) org.powermock.reflect.internal.WhiteboxImpl.doInvokeMethod(WhiteboxImpl.java:813) org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:681) org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:401) org.powermock.classloading.AbstractClassloaderExecutor.getResult(AbstractClassloaderExecutor.java:76) org.powermock.classloading.AbstractClassloaderExecutor.invokeWithClassLoader(AbstractClassloaderExecutor.java:64) org.powermock.classloading.AbstractClassloaderExecutor.executeWithClassLoader(AbstractClassloaderExecutor.java:56) org.powermock.classloading.SingleClassloaderExecutor.execute(SingleClassloaderExecutor.java:33) org.powermock.classloading.AbstractClassloaderExecutor.execute(AbstractClassloaderExecutor.java:40) org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:75) org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) org.junit.runners.ParentRunner.run(ParentRunner.java:309) fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.runTestCase(TestRunner.java:134) fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.doRun(TestRunner.java:89) fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.run(TestRunner.java:70) java.lang.Thread.run(Thread.java:833)
from orika.
Related Issues (20)
- Orika cannot find correct converter with class type define equals to compare typekey HOT 3
- can not converter source list to destination list with same enum property
- Workaround for multiple CustomConverters with the same (could be anonymous) classes.
- Integer how to map thrift TEnum
- Thank you for replying to the question about converting Java objects from map
- NPE while mapAsList invocation
- bean has list<Map> can't do trans completed! HOT 2
- Wrong ObjectFactory generated when destination object has no args and all args constructor HOT 1
- Provide built-in support for type com.fasterxml.jackson.databind.JsonNode
- Totally remove java-szieof
- Optimize MapperGenerator class so that there will be no method code length limit
- Mapping Member inner class from another simple class not working
- not support jdk17? HOT 9
- 【BUG】Generic object mapping ClassCastException occut.
- Is there gonna be any new release for the Orika core? HOT 1
- Same object with different fields?
- Is there gonna be any new release for the Orika core?
- It may not work to use generics when defining mappings in Orika
- Spring boot native image support Java 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orika.