ehcache 3.X failing for JDK 11

1,189 views
Skip to first unread message

ripunj agarwal

unread,
Oct 18, 2019, 2:31:28 AM10/18/19
to ehcache-dev
  1. What version of Ehcache you are currently using:   hibernate-ehcache 5.3.7 and ehcache 2.10.6
  2. Paste the configuration for the Cache/CacheManager you have an issue with;  See below
  3. Add any name and version of other library or framework you use Ehcache with (e.g. Hibernate); Hibernate
  4. Providing JDK and OS versions maybe useful as well.   Oracle JDK 11 and Windows 2019 
Problem Description: 
Spring boot application 2.1.3 Release using Hibernate 5.3.7 with ehcache 2.10.6 compiled under JDK 8 is reporting this exception when running under JDK 11.   Just wondering if ehcache supports running under JDK 11 and if not, what migration steps to follow to support JDK 11?

Unable to make field private jdk.internal.reflect.ConstructorAccessorImpl jdk.internal.reflect.DelegatingConstructorAccessorImpl.delegate accessible: module java.base does not "opens jdk.internal.reflect" to unnamed module @1e6a3214

ERROR STACK TRACE = [java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340), java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280), java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176), java.base/java.lang.reflect.Field.setAccessible(Field.java:170), net.sf.ehcache.pool.sizeof.ObjectGraphWalker.getAllFields(ObjectGraphWalker.java:271), net.sf.ehcache.pool.sizeof.ObjectGraphWalker.getFilteredFields(ObjectGraphWalker.java:229), net.sf.ehcache.pool.sizeof.ObjectGraphWalker.walk(ObjectGraphWalker.java:160), net.sf.ehcache.pool.sizeof.SizeOf.deepSizeOf(SizeOf.java:72), net.sf.ehcache.pool.impl.DefaultSizeOfEngine.sizeOf(DefaultSizeOfEngine.java:190), net.sf.ehcache.pool.impl.AbstractPoolAccessor.add(AbstractPoolAccessor.java:63), net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:281), net.sf.ehcache.Cache.putInternal(Cache.java:1616), net.sf.ehcache.Cache.put(Cache.java:1542), net.sf.ehcache.Cache.put(Cache.java:1507), org.hibernate.cache.ehcache.internal.StorageAccessImpl.putIntoCache(StorageAccessImpl.java:71), org.hibernate.cache.spi.support.DomainDataStorageAccess.putFromLoad(DomainDataStorageAccess.java:25), org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.putFromLoad(AbstractCachedDomainDataAccess.java:62), org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.putFromLoad(AbstractCachedDomainDataAccess.java:73), org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:226), org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129), org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1151), org.hibernate.loader.Loader.processResultSet(Loader.java:1010), org.hibernate.loader.Loader.doQuery(Loader.java:948), org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340), org.hibernate.loader.Loader.doList(Loader.java:2689), org.hibernate.loader.Loader.doList(Loader.java:2672), org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2506), org.hibernate.loader.Loader.list(Loader.java:2501), org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338), org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:2223), org.hibernate.internal.AbstractSharedSessionContract.list(AbstractSharedSessionContract.java:1053), org.hibernate.query.internal.NativeQueryImpl.doList(NativeQueryImpl.java:170), org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1505), org.hibernate.query.Query.getResultList(Query.java:135), .....


Configuration file: 
<?xml version="1.0" encoding="UTF-8"?>
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true" maxBytesLocalHeap="150M">

<diskStore path="java.io.tmpdir/ehcache" />

<defaultCache eternal="false" timeToIdleSeconds="120"
timeToLiveSeconds="120" diskSpoolBufferSizeMB="30"
diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU"
statistics="true">

</defaultCache>


<cache name="org.hibernate.cache.internal.StandardQueryCache"
eternal="false" timeToLiveSeconds="120">

</cache>

<cache name="org.hibernate.cache.spi.UpdateTimestampsCache"
eternal="true">

</cache>
</ehcache>

Chris Dennis

unread,
Oct 21, 2019, 8:33:53 PM10/21/19
to ehcac...@googlegroups.com
If you want to use byte-based sizing in Ehcache 2 or 3 then you need to open up the modules that contain the cached types (including all types within the cached object graph) to access by the Ehcache module (or all unnamed modules). Other than that I believe Ehcache 3 should work fine in Java 11. Ehcache 2 is not something that I’ve tested, although I know of no reason why it wouldn’t work.

Chris


--
You received this message because you are subscribed to the Google Groups "ehcache-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-dev/2a76970c-e122-472e-835a-c94fd7b1b25c%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages