[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] java.lang.reflect.InaccessibleObjectException error in webapp
|
Hi,
On Thu, Aug 22, 2024 at 11:05 AM Paul B. Henson via jetty-users
<jetty-users@xxxxxxxxxxx> wrote:
> public final boolean
> java.util.LinkedHashMap$LinkedHashIterator.hasNext() accessible: module
> java.base does not "opens java.util" to unnamed module @4eb45fec
This is an attempt to access a package protected class of the JDK, so
it's "deep reflection" into JDK code, which is now disallowed.
You should bring this issue to the Spring Project.
Errors of this kind may stem from the wrong usage of reflection, for example:
Object iter = new LinkedHashMap().iterator();
iter.getClass().getMethod("hasNext").invoke(iter); // throws
Iterator.class.getMethod("hasNext").invoke(iter); // ok
The problem is iter.getClass() that returns the private JDK class,
while Iterator.class is the public JDK class that should be used.
In this specific case, there could be more, but it's a Spring issue,
not Jetty's.
--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.