Open cdalexndr opened 3 years ago
If you could include a stack trace and the XML or programatic configuration you are using that would be helpful. The intention is that the ResilienceStrategy
mechanism handles this problem. If this case is skirting that then there may be a bug here.
Configuration:
@Configuration
@ConditionalOnProperty(name = "spring.cache.type", havingValue = "JCACHE")
public class CacheConfiguration extends JCacheRegionFactory {
private static final Logger log = LoggerFactory.getLogger( CacheConfiguration.class );
private static javax.cache.CacheManager CACHE_MANAGER;
private static org.ehcache.config.CacheConfiguration<Object, Object> DEFAULT_CACHE_CONFIGURATION =
CacheConfigurationBuilder.newCacheConfigurationBuilder(
Object.class, Object.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap( 10000, EntryUnit.ENTRIES )
.disk( 100, MemoryUnit.MB, true )
.build() )
.build();
private static CacheManager buildCacheManager() {
CachingProvider cachingProvider = Caching.getCachingProvider();
if (!(cachingProvider instanceof EhcacheCachingProvider))
throw new IllegalStateException( "Missing ehcache" );
EhcacheCachingProvider ehcacheProvider = (EhcacheCachingProvider) cachingProvider;
return ehcacheProvider.getCacheManager( ehcacheProvider.getDefaultURI(), getConfiguration() );
}
private static CacheManager getCacheManagerInstance() {
if (CACHE_MANAGER == null || CACHE_MANAGER.isClosed())
CACHE_MANAGER = buildCacheManager();
return CACHE_MANAGER;
}
protected Cache<Object, Object> createCache( String regionName ) {
return getCacheManager().createCache( regionName, Eh107Configuration.fromEhcacheCacheConfiguration( DEFAULT_CACHE_CONFIGURATION ) );
}
@Override
protected javax.cache.CacheManager resolveCacheManager( SessionFactoryOptions settings, Map properties ) {
return getCacheManagerInstance();
}
@Bean
public CacheManager jCacheCacheManager() {
return getCacheManagerInstance();
}
private static DefaultConfiguration getConfiguration() {
CachingProvider cachingProvider = Caching.getCachingProvider();
assert cachingProvider instanceof EhcacheCachingProvider;
EhcacheCachingProvider ehcacheProvider = (EhcacheCachingProvider) cachingProvider;
DefaultConfiguration configuration = new DefaultConfiguration(
ehcacheProvider.getDefaultClassLoader(),
new DefaultPersistenceConfiguration( new File( "./cache" ) ),
new Jsr107Configuration( "default",
Collections.emptyMap(),
true,
ConfigurationElementState.ENABLED, //management
ConfigurationElementState.ENABLED //statistics
) );
configureQueryCache( configuration );
configureEntitiesCache( configuration );
...
SearchCacheService.configureCache( configuration );
return configuration;
}
private static void configureEntitiesCache( DefaultConfiguration configuration ) {
final ResourcePools LARGE_HEAP = ResourcePoolsBuilder.heap( 1_000_000 ).build();
configureEntityCache( configuration, MyEntity.class, LARGE_HEAP );
...
}
private static void configureEntityCache( DefaultConfiguration configuration, Class<?> entityClass, ResourcePools resourcePools ) {
assert !entityClass.isArray() && !entityClass.isEnum();
String name = entityClass.getName();
configuration.addCacheConfiguration( name, CacheConfigurationBuilder.newCacheConfigurationBuilder(
Object.class, Object.class,
resourcePools ).build() );
}
private static void configureQueryCache( DefaultConfiguration configuration ) {
configuration.addCacheConfiguration( DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, CacheConfigurationBuilder.newCacheConfigurationBuilder(
Object.class, Object.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap( 300, EntryUnit.ENTRIES )
.disk( 2, MemoryUnit.GB, true )
.build() )
.build() );
configuration.addCacheConfiguration( DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME, CacheConfigurationBuilder.newCacheConfigurationBuilder(
Object.class, Object.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap( 1000, EntryUnit.ENTRIES )
.disk( 2, MemoryUnit.GB, true )
.build() )
.build() );
}
}
Stacktrace:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shopCrawlerInfoService' defined in file [/BOOT-INF/classes/pse/site/crawler/shop/ShopCrawlerInfoService.class]: Invocation of init method failed; nested exception is org.ehcache.spi.serialization.SerializerException: Seeing this exception and having no other serialization related issues is a red flag!
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.3.jar:5.3.3]
... 139 common frames omitted
Caused by: org.ehcache.spi.serialization.SerializerException: Seeing this exception and having no other serialization related issues is a red flag!
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.deserialize(LazyOffHeapValueHolder.java:103) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.forceDeserialization(LazyOffHeapValueHolder.java:93) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.get(LazyOffHeapValueHolder.java:50) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.heap.OnHeapStore.cloneValueHolder(OnHeapStore.java:1493) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.heap.OnHeapStore.importValueFromLowerTier(OnHeapStore.java:1483) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.heap.OnHeapStore.resolveFault(OnHeapStore.java:771) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.heap.OnHeapStore.getOrComputeIfAbsent(OnHeapStore.java:707) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.tiering.TieredStore.get(TieredStore.java:87) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.core.Ehcache.doGet(Ehcache.java:90) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.core.EhcacheBase.get(EhcacheBase.java:127) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.jsr107.Eh107Cache.get(Eh107Cache.java:90) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.hibernate.cache.jcache.internal.JCacheAccessImpl.getFromCache(JCacheAccessImpl.java:38) ~[hibernate-jcache-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.cache.spi.support.AbstractReadWriteAccess.putFromLoad(AbstractReadWriteAccess.java:100) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.cache.spi.support.AbstractReadWriteAccess.putFromLoad(AbstractReadWriteAccess.java:136) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntityFromEntityEntryLoadedState(TwoPhaseLoad.java:319) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:183) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:151) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.performTwoPhaseLoad(AbstractRowReader.java:248) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.finishUp(AbstractRowReader.java:208) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:96) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:105) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:285) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4442) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4432) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:569) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:537) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:208) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:332) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:108) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:74) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:113) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.internal.SessionImpl.fireLoadNoChecks(SessionImpl.java:1186) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1051) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:697) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.type.EntityType.resolve(EntityType.java:464) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.type.ManyToOneType.resolve(ManyToOneType.java:240) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad$EntityResolver.lambda$static$0(TwoPhaseLoad.java:605) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntityEntryLoadedState(TwoPhaseLoad.java:248) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:182) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:151) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1200) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.processResultSet(Loader.java:1001) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:959) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2850) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2832) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2664) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.Loader.list(Loader.java:2659) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:506) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:400) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:219) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1414) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1625) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1593) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.query.Query.getResultList(Query.java:165) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:76) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:356) ~[spring-data-jpa-2.4.3.jar:2.4.3]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) ~[spring-data-commons-2.4.3.jar:2.4.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-5.3.3.jar:5.3.3]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.3.jar:5.3.3]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-5.3.3.jar:5.3.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-5.3.3.jar:5.3.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) ~[spring-data-jpa-2.4.3.jar:2.4.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.3.jar:5.3.3]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) ~[spring-aop-5.3.3.jar:5.3.3]
at com.sun.proxy.$Proxy158.findAll(Unknown Source) ~[na:na]
at pse.site.crawler.shop.ShopCrawlerInfoService.afterPropertiesSet_aroundBody0(ShopCrawlerInfoService.java:37) ~[classes/:na]
at pse.site.crawler.shop.ShopCrawlerInfoService$AjcClosure1.run(ShopCrawlerInfoService.java:1) ~[classes/:na]
at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96cproceed(AbstractTransactionAspect.aj:67) ~[spring-aspects-5.3.3.jar:5.3.3]
at org.springframework.transaction.aspectj.AbstractTransactionAspect$AbstractTransactionAspect$1.proceedWithInvocation(AbstractTransactionAspect.aj:73) ~[spring-aspects-5.3.3.jar:5.3.3]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-5.3.3.jar:5.3.3]
at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:71) ~[spring-aspects-5.3.3.jar:5.3.3]
at pse.site.crawler.shop.ShopCrawlerInfoService.afterPropertiesSet(ShopCrawlerInfoService.java:37) ~[classes/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.3.jar:5.3.3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.3.jar:5.3.3]
... 149 common frames omitted
Caused by: org.ehcache.spi.serialization.SerializerException: java.io.InvalidClassException: pse.util.web.URLImpl; local class incompatible: stream classdesc serialVersionUID = 2811656300923935404, local class serialVersionUID = 8843180681770330670
at org.ehcache.impl.serialization.PlainJavaSerializer.read(PlainJavaSerializer.java:65) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.deserialize(LazyOffHeapValueHolder.java:99) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
... 242 common frames omitted
Caused by: java.io.InvalidClassException: pse.util.web.URLImpl; local class incompatible: stream classdesc serialVersionUID = 2811656300923935404, local class serialVersionUID = 8843180681770330670
at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:689) ~[na:na]
at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2012) ~[na:na]
at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1862) ~[na:na]
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2169) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679) ~[na:na]
at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2102) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667) ~[na:na]
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464) ~[na:na]
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358) ~[na:na]
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679) ~[na:na]
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464) ~[na:na]
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358) ~[na:na]
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:493) ~[na:na]
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:451) ~[na:na]
at org.ehcache.impl.serialization.PlainJavaSerializer.read(PlainJavaSerializer.java:62) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
... 243 common frames omitted
This looks like it's a bug with exceptions that get propagated through Fault
objects not getting unwrapped correctly and therefore managing to bypass the resilience strategy logic. I'll need some time to dig out this mess before I can begin to propose a fix.
Here's another stacktrace with more frames, from my workaround that catches this exception:
org.ehcache.spi.serialization.SerializerException: java.io.InvalidClassException: pse.util.web.URLImpl; local class incompatible: stream classdesc serialVersionUID = 2811656300923935404, local class serialVersionUID = 8843180681770330670
at org.ehcache.impl.serialization.PlainJavaSerializer.read(PlainJavaSerializer.java:65)
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.deserialize(LazyOffHeapValueHolder.java:99)
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.forceDeserialization(LazyOffHeapValueHolder.java:93)
at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.get(LazyOffHeapValueHolder.java:50)
at org.ehcache.impl.internal.store.disk.factories.EhcachePersistentSegmentFactory$EhcachePersistentSegment$EntrySet$1.create(EhcachePersistentSegmentFactory.java:134)
at org.ehcache.impl.internal.store.disk.factories.EhcachePersistentSegmentFactory$EhcachePersistentSegment$EntrySet$1.create(EhcachePersistentSegmentFactory.java:130)
at org.ehcache.shadow.org.terracotta.offheapstore.OffHeapHashMap$HashIterator.<init>(OffHeapHashMap.java:1390)
at org.ehcache.shadow.org.terracotta.offheapstore.OffHeapHashMap$EntryIterator.<init>(OffHeapHashMap.java:1525)
at org.ehcache.shadow.org.terracotta.offheapstore.AbstractLockedOffHeapHashMap$LockedEntryIterator.<init>(AbstractLockedOffHeapHashMap.java:385)
at org.ehcache.impl.internal.store.disk.factories.EhcachePersistentSegmentFactory$EhcachePersistentSegment$EntrySet$1.<init>(EhcachePersistentSegmentFactory.java:130)
at org.ehcache.impl.internal.store.disk.factories.EhcachePersistentSegmentFactory$EhcachePersistentSegment$EntrySet.iterator(EhcachePersistentSegmentFactory.java:130)
at org.ehcache.shadow.org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapMap$AggregateEntrySet$1.getNextIterator(AbstractConcurrentOffHeapMap.java:454)
at org.ehcache.shadow.org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapMap$AggregateIterator.<init>(AbstractConcurrentOffHeapMap.java:520)
at org.ehcache.shadow.org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapMap$AggregateEntrySet$1.<init>(AbstractConcurrentOffHeapMap.java:450)
at org.ehcache.shadow.org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapMap$AggregateEntrySet.iterator(AbstractConcurrentOffHeapMap.java:450)
at org.ehcache.impl.internal.store.offheap.AbstractOffHeapStore$1.<init>(AbstractOffHeapStore.java:501)
at org.ehcache.impl.internal.store.offheap.AbstractOffHeapStore.iterator(AbstractOffHeapStore.java:500)
at org.ehcache.impl.internal.store.tiering.TieredStore.iterator(TieredStore.java:215)
at org.ehcache.core.SpecIterator.<init>(SpecIterator.java:39)
at org.ehcache.core.EhcacheBase$Jsr107CacheBase.specIterator(EhcacheBase.java:645)
at org.ehcache.jsr107.Eh107Cache.iterator(Eh107Cache.java:518)
at pse.CacheConfiguration.validateCache(CacheConfiguration.java:77)
After changing some classes and deploying, accessing the existing cache fails with
org.ehcache.spi.serialization.SerializerException: java.io.InvalidClassException: local class incompatible:...
because of differentserialVersionUID
.It would be helpful to provide some method to automatically clear the cache and return
null
(not exists) instead of propagating exception and disrupting program workflow. This way, the user will not have to implement custom logic to handle this exception.ehcache 3.8.1