The REST server uses Jackson deserialisation to a class (a.b.c.d.Application) which has a private constructor which worked just fine when using Java 8. After we migrated to Java 17 and replacing all javax.* to jakarta.* libraries, I am seeing this exception:
java.lang.IllegalAccessException: class org.eclipse.yasson.internal.ReflectionUtils cannot access a member of class a.b.c.d.Application with modifiers "private"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.eclipse.yasson.internal.ReflectionUtils.createNoArgConstructorInstance(ReflectionUtils.java:274)
Wrapped by: jakarta.json.bind.JsonbException: Can't create instance
at org.eclipse.yasson.internal.ReflectionUtils.createNoArgConstructorInstance(ReflectionUtils.java:276)
I tried adding @JsonCreator annotation to the private constructor which could help Jackson use the constructor but with no luck.