Open ilapavuluri opened 1 year ago
It is planned to drop support for Java 8 with the first release of Ehcache 4. Until that happens dropping use of Unsafe would require a multi-release JAR or multiple artifact variants, and then maintaining two versions of the code internally. This is all possible, but not something that there is the bandwidth to pick up immediately.
Thank you @chrisdennis for the quick response, until then do we need to go with the work around of adding "--add-opens java.base/{PACKAGE}=ALL-UNNAMED" ?
How to identify the complete list of packages which we need to open to avoid below kind of errors during the runtime?
java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.ref.SoftReference java.util.jar.JarFile.manRef accessible: module java.base does not "opens java.util.jar" to unnamed module @5f9d7597 at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?] at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?] at java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[?:?] at java.lang.reflect.Field.setAccessible(Field.java:172) ~[?:?] at net.sf.ehcache.pool.sizeof.ObjectGraphWalker.getAllFields(ObjectGraphWalker.java:271) ~[ehcache-core.jar:?] at net.sf.ehcache.pool.sizeof.ObjectGraphWalker.getFilteredFields(ObjectGraphWalker.java:229) ~[ehcache-core.jar:?] at net.sf.ehcache.pool.sizeof.ObjectGraphWalker.walk(ObjectGraphWalker.java:160) ~[ehcache-core.jar:?] at net.sf.ehcache.pool.sizeof.SizeOf.deepSizeOf(SizeOf.java:73) ~[ehcache-core.jar:?] at net.sf.ehcache.pool.impl.DefaultSizeOfEngine.sizeOf(DefaultSizeOfEngine.java:173) ~[ehcache-core.jar:?] at net.sf.ehcache.pool.impl.AbstractPoolAccessor.add(AbstractPoolAccessor.java:63) ~[ehcache-core.jar:?] at net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:258) ~[ehcache-core.jar:?] at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:257) ~[ehcache-core.jar:?]
Hi Team,
As part of Java17 upgrade when I ran "jdeps -jdkinternals ehcache-3.10.8.jar" I am getting below error:
org.ehcache.impl.internal.concurrent.ConcurrentHashMap (ehcache-3.10.8.jar) -> sun.misc.Unsafe JDK internal API (rt.jar) org.ehcache.impl.internal.concurrent.ConcurrentHashMap$CounterCell (ehcache-3.10.8 (1).jar) -> sun.misc.Contended JDK internal API (rt.jar) org.ehcache.impl.internal.concurrent.ConcurrentHashMap$TreeBin (ehcache-3.10.8 (1).jar) -> sun.misc.Unsafe JDK internal API (rt.jar) org.ehcache.impl.internal.concurrent.ThreadLocalRandomUtil (ehcache-3.10.8 (1).jar) -> sun.misc.Unsafe JDK internal API (rt.jar) org.ehcache.sizeof.impl.UnsafeSizeOf (ehcache-3.10.8 (1).jar) -> sun.misc.Unsafe JDK internal API (rt.jar)
It is complaining about usage of internal API's.
Please do the needful.
Thanks Ashok.