HotRod ISPN000136: Execution error java.lang.ClassCastException: [B cannot be cast to org.infinispan.container.entries.CacheEntry
enrico.olivelli May 8, 2015 6:00 AMHi,
I'm going to upgrade to Infinspan 7.2.1final but I got into a showstopper. This error occours very frequently and the cluster becomes not usable.
In dev enviroment I'm using only Java HotRod clients and 3 Java HotRod Servers. When I put a "byte[]" in a cache then the following error occurs.
Using only one Hotrod server the error does not occur.
ERROR interceptors.InvocationContextInterceptor: ISPN000136: Execution error
java.lang.ClassCastException: [B cannot be cast to org.infinispan.container.entries.CacheEntry
at org.infinispan.interceptors.compat.BaseTypeConverterInterceptor.visitGetCacheEntryCommand(BaseTypeConverterInterceptor.java:118)
at org.infinispan.commands.read.GetCacheEntryCommand.acceptVisitor(GetCacheEntryCommand.java:39)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)
at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:102)
at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:71)
at org.infinispan.commands.AbstractVisitor.visitGetCacheEntryCommand(AbstractVisitor.java:91)
at org.infinispan.commands.read.GetCacheEntryCommand.acceptVisitor(GetCacheEntryCommand.java:39)
at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:336)
at org.infinispan.cache.impl.CacheImpl.getCacheEntry(CacheImpl.java:437)
at org.infinispan.cache.impl.DecoratedCache.getCacheEntry(DecoratedCache.java:547)
at org.infinispan.server.hotrod.CacheDecodeContext.get(CacheDecodeContext.scala:180)
at org.infinispan.server.hotrod.HotRodDecoder.org$infinispan$server$hotrod$HotRodDecoder$$decodeKey(HotRodDecoder.scala:103)
at org.infinispan.server.hotrod.HotRodDecoder$$anonfun$decode$1.apply$mcV$sp(HotRodDecoder.scala:48)
at org.infinispan.server.hotrod.HotRodDecoder$$anon$1.run(HotRodDecoder.scala:206)
at org.infinispan.server.hotrod.HotRodDecoder$$anon$1.run(HotRodDecoder.scala:205)
at org.infinispan.security.Security.doAs(Security.java:143)
at org.infinispan.server.hotrod.HotRodDecoder.wrapSecurity(HotRodDecoder.scala:205)
at org.infinispan.server.hotrod.HotRodDecoder.decode(HotRodDecoder.scala:45)
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:370)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:168)
at org.infinispan.server.hotrod.HotRodDecoder.org$infinispan$server$core$transport$StatsChannelHandler$$super$channelRead(HotRodDecoder.scala:31)
at org.infinispan.server.core.transport.StatsChannelHandler$class.channelRead(StatsChannelHandler.scala:32)
at org.infinispan.server.hotrod.HotRodDecoder.channelRead(HotRodDecoder.scala:31)
....
Cache Server configuration:
Configuration wildcard = new ConfigurationBuilder()
.locking().lockAcquisitionTimeout(lockAcquisitionTimeout)
.concurrencyLevel(10000).isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(true)
.clustering()
.cacheMode(CacheMode.DIST_SYNC)
.l1().lifespan(l1ttl).enable()
.hash().numOwners(numOwners).capacityFactor(capacityFactor)
.partitionHandling().enabled(false)
.stateTransfer().awaitInitialTransfer(false).timeout(initialTransferTimeout).fetchInMemoryState(false)
.storeAsBinary().enabled(true).storeKeysAsBinary(false).storeValuesAsBinary(false)
.jmxStatistics().enable()
.unsafe().unreliableReturnValues(true) // put e remove non ritornano il valore precedente, tanto a noi non interessa
.compatibility().enable()
.build();
Hotrod Endpoint:
HotRodServerConfigurationBuilder configBuilder = new HotRodServerConfigurationBuilder()
.host(address)
.port(port);
hotrodserver.start(configBuilder
.build(),
manager);
Client side config:
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder().forceReturnValues(false);
clientBuilder.nearCache().mode(NearCacheMode.LAZY).maxEntries(10000);
(for each server....)
clientBuilder.addServer().host(serveraddress).port(serverport);
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(clientBuilder.build());