Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Yasson » Jersey 2.40 + JDK 17 (IllegalAccessException seen with REST service with JDK 17 and Jersey 2.40)
Jersey 2.40 + JDK 17 [message #1861456] Fri, 13 October 2023 12:44
Abhijit Bhatode is currently offline Abhijit BhatodeFriend
Messages: 1
Registered: October 2023
Junior Member

Hello team,

I came across [yasson-dev] Issue with yasson jar in jaxrs-ri-2.27. (eclipse.org). But, we are using Jersey 2.40 with JDK 17.

Below exception is seen with REST service is sending a response:

---------------------------
Caused By: java.lang.IllegalAccessException: class org.eclipse.yasson.internal.model.GetFromGetter cannot access class sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl (in module java.base) because module java.base does not export sun.reflect.annotation to unnamed module @6c0d7c83
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.Method.invoke(Method.java:560)
at org.eclipse.yasson.internal.model.GetFromGetter.internalGetValue(GetFromGetter.java:28)
-----------------------------
I tried adding below in module-info.java file and adding the compiled class in the root of the JAR containing the JAXB related model classes. But, this did not work.


module mycompanyrest {
opens mycompany.rest.model.policy;
exports mycompany.rest.model.policy;
}

After adding JVM options --add-opens java.base/sun.reflect.annotation=ALL-UNNAMED & --add-exports java.base/sun.reflect.annotation=ALL-UNNAMED
error message changed to

------------------------
Caused By: java.lang.IllegalAccessException: class org.eclipse.yasson.internal.model.GetFromGetter cannot access a member of class sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl (in module java.base) with modifiers "public"
------------------
Thank you for your help in advance.

Regards,
Abhijit
Previous Topic:Issue with Yasson jar in jaxrs-ri-2.27.
Goto Forum:
  


Current Time: Sat Nov 11 05:59:29 GMT 2023

Powered by FUDForum. Page generated in 0.01384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top