问题
I try to start a cache with a SingleFileStore for infinispan with have the following config:
confBuilder.persistence().addSingleFileStore()
.location("Something").fetchPersistentState(Boolean.TRUE)
.preload(true).purgeOnStartup(false);
but after upgrading to a newer version of infinispan I start getting the following error:
Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.persistence.manager.PersistenceManagerImpl.preload() on object of type PersistenceManagerImpl
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:171)
at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:869)
at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:638)
at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:627)
at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:530)
at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:218)
at org.infinispan.cache.impl.CacheImpl.start(CacheImpl.java:853)
at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:599)
at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:554)
at org.infinispan.manager.DefaultCacheManager.access$100(DefaultCacheManager.java:116)
at org.infinispan.manager.DefaultCacheManager$1.run(DefaultCacheManager.java:453)
Caused by: org.infinispan.persistence.spi.PersistenceException: Cannot preload from cache loader 'org.infinispan.persistence.cluster.ClusterLoader' as it doesn't implement 'org.infinispan.persistence.spi.AdvancedCacheLoader'
at org.infinispan.persistence.manager.PersistenceManagerImpl.preload(PersistenceManagerImpl.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
... 10 more
After decompiling org.infinispan.persistence.cluster.ClusterLoader, I see that it implements Cache but not AdvancedCache. I guess there is a dependency or configuration issue, but I cannot figure out how.
My pom.xml contains the following:
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>8.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjta</artifactId>
<version>4.16.6.Final</version>
</dependency>
If I set preload to false I won't get this error at least.
--------UPDATE---------------
I should probably mention that I see the following error in the flow before:
interceptors.InvocationContextInterceptor (InvocationContextInterceptor.java:140) - ISPN000136: Error executing command SizeCommand, writing keys []
java.lang.NullPointerException
at org.infinispan.distribution.impl.DistributionManagerImpl.getReadConsistentHash(DistributionManagerImpl.java:110) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.stream.impl.AbstractCacheStream.performOperationRehashAware(AbstractCacheStream.java:299) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.stream.impl.AbstractCacheStream.performOperation(AbstractCacheStream.java:258) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.stream.impl.AbstractCacheStream.performOperation(AbstractCacheStream.java:247) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.stream.impl.DistributedCacheStream.count(DistributedCacheStream.java:403) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.commands.read.SizeCommand.perform(SizeCommand.java:54) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
at org.infinispan.commands.read.SizeCommand.perform(SizeCommand.java:25) ~[infinispan-core-8.2.2.Final.jar:8.2.2.Final]
回答1:
This can be connected to one of the issues we have had in the past. Could you please try migrating to the latest stable version (8.2.2).
来源:https://stackoverflow.com/questions/37728067/preloading-issue-with-infinispan-not-instance-of-advancedcacheloader