Hi all,
I’m using hibernate 5.4.4.Final with second level cache enabled. My web app runs on tomcat 9.0.21 on CentOS operating system.
This is the setup of cache at webapp startup:
settings.put(Environment.DIALECT, PostgreSQLeitfeldDialect.class.getName());
settings.put(Environment.DRIVER, Driver.class.getName());
settings.put(Environment.URL, DBConfig.getFullDbUrl());
settings.put(Environment.USER, DBConfig.getUser());
settings.put(Environment.PASS, DBConfig.getPassword());
settings.put(Environment.USE_SECOND_LEVEL_CACHE, true);
settings.put(Environment.CACHE_REGION_FACTORY, JCacheRegionFactory.class.getName());
settings.put(“hibernate.javax.cache.provider”, EhcacheCachingProvider.class.getName());
settings.put(Environment.USE_QUERY_CACHE, true);
settings.put(“hibernate.javax.cache.uri”, “file:” + getClass().getResource(ehcacheXMLFile).getFile());
settings.put(“hibernate.javax.cache.missing_cache_strategy”, “fail”);
if(DBConfig.getTestMode()) {
settings.put(Environment.SHOW_SQL, true);
settings.put(Environment.FORMAT_SQL, true);
settings.put(Environment.USE_SQL_COMMENTS, true);
} else {
settings.put(Environment.C3P0_MIN_SIZE, 5);
settings.put(Environment.C3P0_MAX_SIZE, 20);
settings.put(Environment.C3P0_TIMEOUT, 300);
settings.put(Environment.C3P0_MAX_STATEMENTS, 50);
settings.put(Environment.C3P0_IDLE_TEST_PERIOD, 3000);
}
When the app is deployed I have this error in tomcat log file
org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.CacheImplementor][07-08-2019 11:52:22.478] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
I also logged Cache at debug level; this is the output:
[07-08-2019 11:52:20.576] [main] DEBUG org.ehcache.impl.internal.store.heap.OnHeapStore strategy - TTI or custom expiration strategy detected
[07-08-2019 11:52:20.582] [main] INFO org.ehcache.core.EhcacheManager createCache - Cache 'lt.model.ModelAction.params' created in EhcacheManager.
[07-08-2019 11:52:20.583] [main] DEBUG org.ehcache.core.EhcacheManager createCache - Creating Cache 'lt.model.Device##NaturalId' in EhcacheManager.
[07-08-2019 11:52:20.583] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@50bac431
[07-08-2019 11:52:20.583] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@1de8248f
[07-08-2019 11:52:20.583] [main] DEBUG org.ehcache.impl.internal.spi.copy.DefaultCopyProvider createCopier - Copier for : org.ehcache.impl.copy.IdentityCopier@68dc7f43
[07-08-2019 11:52:20.584] [main] DEBUG org.ehcache.impl.internal.spi.copy.DefaultCopyProvider createCopier - Copier for : org.ehcache.impl.copy.IdentityCopier@137efccc
[07-08-2019 11:52:20.584] [main] DEBUG org.ehcache.impl.internal.store.heap.OnHeapStore strategy - TTI or custom expiration strategy detected
[07-08-2019 11:52:20.590] [main] INFO org.ehcache.core.EhcacheManager createCache - Cache 'lt.model.Device##NaturalId' created in EhcacheManager.
[07-08-2019 11:52:20.590] [main] DEBUG org.ehcache.core.EhcacheManager createCache - Creating Cache 'lt.model.Group' in EhcacheManager.
[07-08-2019 11:52:20.591] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@63f8fded
[07-08-2019 11:52:20.591] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@30e3ca4a
[07-08-2019 11:52:20.591] [main] DEBUG org.ehcache.impl.internal.spi.copy.DefaultCopyProvider createCopier - Copier for : org.ehcache.impl.copy.IdentityCopier@49dc8842
[07-08-2019 11:52:20.591] [main] DEBUG org.ehcache.impl.internal.spi.copy.DefaultCopyProvider createCopier - Copier for : org.ehcache.impl.copy.IdentityCopier@56c802bc
[07-08-2019 11:52:20.591] [main] DEBUG org.ehcache.impl.internal.store.heap.OnHeapStore strategy - TTI or custom expiration strategy detected
[07-08-2019 11:52:20.597] [main] INFO org.ehcache.core.EhcacheManager createCache - Cache 'lt.model.Group' created in EhcacheManager.
[07-08-2019 11:52:20.597] [main] DEBUG org.ehcache.core.EhcacheManager createCache - Creating Cache 'lt.model.Language.customLabels' in EhcacheManager.
[07-08-2019 11:52:20.597] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@b97bc80
[07-08-2019 11:52:20.597] [main] DEBUG org.ehcache.impl.internal.spi.serialization.DefaultSerializationProvider constructSerializer - Serializer for : org.ehcache.impl.serialization.PlainJavaSerializer@2090d3d1
[07-08-2019 11:52:20.598] [main] DEBUG org.ehcache.impl.internal.spi.copy.DefaultCopyProvider createCopier - Copier for : org.ehcache.impl.copy.IdentityCopier@172194b9
....
....
....
[07-08-2019 11:52:22.464] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘luminare.model.Field’ removed from EhcacheManager.
[07-08-2019 11:52:22.464] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.FamilyAction.params’ removed from EhcacheManager.
[07-08-2019 11:52:22.465] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘query.Leitfeld.ComboList’ removed from EhcacheManager.
[07-08-2019 11:52:22.465] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.FamilyActionParam.customLabels’ removed from EhcacheManager.
[07-08-2019 11:52:22.466] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.Message’ removed from EhcacheManager.
[07-08-2019 11:52:22.466] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.Device.devicedata’ removed from EhcacheManager.
[07-08-2019 11:52:22.467] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.FamilyProperty.modelProperties’ removed from EhcacheManager.
[07-08-2019 11:52:22.468] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘query.TicketingSystem.IssueList’ removed from EhcacheManager.
[07-08-2019 11:52:22.468] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.Deployment.devices’ removed from EhcacheManager.
[07-08-2019 11:52:22.469] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.Family.devices’ removed from EhcacheManager.
[07-08-2019 11:52:22.469] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘query.Leitfeld.Families’ removed from EhcacheManager.
[07-08-2019 11:52:22.470] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘leitfeld.model.AccessAdmin’ removed from EhcacheManager.
[07-08-2019 11:52:22.470] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.Bridge.nodeModels’ removed from EhcacheManager.
[07-08-2019 11:52:22.471] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘statistic.model.Config##NaturalId’ removed from EhcacheManager.
[07-08-2019 11:52:22.472] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.User’ removed from EhcacheManager.
[07-08-2019 11:52:22.472] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘ticket.model.IssueState’ removed from EhcacheManager.
[07-08-2019 11:52:22.473] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.FamilyActionParam’ removed from EhcacheManager.
[07-08-2019 11:52:22.473] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.NatsSetting##NaturalId’ removed from EhcacheManager.
[07-08-2019 11:52:22.474] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.FamilyProperty.customLabels’ removed from EhcacheManager.
[07-08-2019 11:52:22.474] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘maps.model.LinkFamilyIcon’ removed from EhcacheManager.
[07-08-2019 11:52:22.474] [main] INFO org.ehcache.core.EhcacheManager removeCache - Cache ‘lt.model.DgLink’ removed from EhcacheManager.
[07-08-2019 11:52:22.475] [main] DEBUG org.ehcache.core.spi.ServiceLocator stopAllServices - Stopping 18 Services…
[07-08-2019 11:52:22.476] [main] DEBUG org.ehcache.impl.internal.statistics.DefaultStatisticsService stop - Stopping service
[07-08-2019 11:52:22.477] [main] DEBUG org.ehcache.core.spi.ServiceLocator stopAllServices - All Services successfully stopped, 18 Services in 2ms
[07-08-2019 11:52:22.478] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 11:57:58.990] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:02:21.713] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:17:25.773] [Catalina-utility-1] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:19:09.335] [Catalina-utility-1] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:21:59.132] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:29:54.517] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:30:22.884] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 11:57:58.990] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
[07-08-2019 12:02:21.713] [main] ERROR org.ehcache.core.EhcacheManager failed - Initialize failed.
Same configuration on different Linux O.S. (Debian) works fine!
Thanks in advance for the answer.
More from exceptionCaused by: java.lang.IllegalArgumentException: An attempt was made to allocate more off-heap memory than the JVM can allow. The limit on off-heap memory size is given by the -XX:MaxDirectMemorySize command (or equivalent).
at org.terracotta.offheapstore.paging.UpfrontAllocatingPageSource.bufferAllocation(UpfrontAllocatingPageSource.java:564)
at org.terracotta.offheapstore.paging.UpfrontAllocatingPageSource.lambda$allocateBackingBuffers$1(UpfrontAllocatingPageSource.java:513)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)