2 Replies Latest reply on Dec 8, 2011 7:16 PM by Roshan Pradeep

    Infinispan (infinispan-5.0.1.FINAL) + HotRod + Cassandra 0.7.10 cache access problem

    Roshan Pradeep Newbie

      Hi All

       

      I am currently setting up the Infinispan hotrod with cassandra 0.7.10 and they are working fine. I used the below simple java program to access the remote cache store and trying to put simple object to the cassandra specific named cache, but getting this error while putting to cache.

       

      public class CacheManager {

       

          private RemoteCache<Object, Object> remoteCache;

          private RemoteCacheManager remoteCacheManager;

          private static final String CACHE_NAME = "cassandraCache";

       

          private void getRemoteCache()

          {

              Properties prop = new Properties();

              String name = new String("Test Name");

              Integer age = new Integer(33);

       

              try

              {

                  prop.load(new FileInputStream("hotrod.properties"));

              }

              catch (IOException e)

              {

                  e.printStackTrace();

              }

       

              remoteCacheManager = new RemoteCacheManager(prop);

              remoteCache= remoteCacheManager.getCache(CACHE_NAME);

              remoteCache.put(name, age);

          }

       

          public static void main(String[] args) {

              CacheManager cm = new CacheManager();

              cm.getRemoteCache();

          }

      }

       

      The error I am getting is:

       

      2011-12-08 11:31:27,344 ERROR [InvocationContextInterceptor] (HotRodServerWorker-1-4) ISPN000136: Execution error

      org.infinispan.loaders.CacheLoaderException: org.infinispan.loaders.keymappers.UnsupportedKeyTypeException: Unsupported key type: 'org.infinispan.util.ByteArrayKey' on key: ByteArrayKey{data=ByteArray{size=6, hashCode=36101d01, array=[3, 66, 1, 42, 73, 10, ..]}}

              at org.infinispan.loaders.cassandra.CassandraCacheStore.store(CassandraCacheStore.java:432)

              at org.infinispan.interceptors.CacheStoreInterceptor.visitPutKeyValueCommand(CacheStoreInterceptor.java:210)

              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

              at org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:82)

              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

              at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:133)

              at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)

              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

              at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:214)

              at org.infinispan.interceptors.TxInterceptor.visitPutKeyValueCommand(TxInterceptor.java:162)

              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

              at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

              at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:104)

              at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:64)

              at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)

              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

              at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:274)

              at org.infinispan.CacheImpl.put(CacheImpl.java:518)

              at org.infinispan.server.core.AbstractProtocolDecoder.put(AbstractProtocolDecoder.scala:185)

              at org.infinispan.server.core.AbstractProtocolDecoder.decodeValue(AbstractProtocolDecoder.scala:141)

              at org.infinispan.server.core.AbstractProtocolDecoder.decode(AbstractProtocolDecoder.scala:71)

              at org.infinispan.server.core.AbstractProtocolDecoder.decode(AbstractProtocolDecoder.scala:45)

              at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:471)

              at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:444)

              at org.infinispan.server.core.AbstractProtocolDecoder.messageReceived(AbstractProtocolDecoder.scala:347)

              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)

              at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350)

              at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)

              at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)

              at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

              at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(Thread.java:619)

      Caused by: org.infinispan.loaders.keymappers.UnsupportedKeyTypeException: Unsupported key type: 'org.infinispan.util.ByteArrayKey' on key: ByteArrayKey{data=ByteArray{size=6, hashCode=36101d01, array=[3, 66, 1, 42, 73, 10, ..]}}

              at org.infinispan.loaders.cassandra.CassandraCacheStore.hashKey(CassandraCacheStore.java:597)

              at org.infinispan.loaders.cassandra.CassandraCacheStore.store0(CassandraCacheStore.java:444)

              at org.infinispan.loaders.cassandra.CassandraCacheStore.store(CassandraCacheStore.java:428)

       

      This is how I configured the cassandra cache with infinispan.

       

         <namedCache name="cassandraCache">

              <loaders passivation="false" shared="true" preload="false">

                      <loader

                              class="org.infinispan.loaders.cassandra.CassandraCacheStore"

                              fetchPersistentState="true" ignoreModifications="false"

                              purgeOnStartup="false">

                              <properties>

                                      <property name="host" value="10.1.161.69" />

                                      <property name="keySpace" value="Infinispan" />

                                      <property name="entryColumnFamily" value="InfinispanEntries" />

                                      <property name="expirationColumnFamily" value="InfinispanExpiration" />

                                      <property name="sharedKeyspace" value="false" />

                                      <property name="readConsistencyLevel" value="ONE" />

                                      <property name="writeConsistencyLevel" value="ONE" />

                                      <property name="configurationPropertiesFile" value="/app/cassandra-config/cassandrapool.properties" />        

                                      <property name="keyMapper" value="org.infinispan.loaders.keymappers.DefaultTwoWayKey2StringMapper" />

                              </properties>

                      </loader>

             </loaders>

         </namedCache>

       

      Could someone please help me to solve this issue. Thanks.


        • 2. Re: Infinispan (infinispan-5.0.1.FINAL) + HotRod + Cassandra 0.7.10 cache access problem
          Roshan Pradeep Newbie

          Thanks Galder for the prompt response.

           

          Because of that reason, I used the Infinispan 5.1.0 CR1 with cassandra 1.0.5 version. Everything is working fine when accessing and putting/getting objects from cache. But after executing my sample java program, I can see the below error on infinispan cluster.

           

          2011-12-09 09:38:32,524 ERROR [HotRodDecoder] (HotRodServerWorker-1-2) ISPN005009: Unexpected error before any request parameters read

          java.io.IOException: Connection reset by peer

                  at sun.nio.ch.FileDispatcher.read0(Native Method)

                  at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)

                  at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)

                  at sun.nio.ch.IOUtil.read(IOUtil.java:200)

                  at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)

                  at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:321)

                  at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)

                  at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                  at java.lang.Thread.run(Thread.java:619)

          2011-12-09 09:38:32,535 ERROR [HotRodDecoder] (HotRodServerWorker-1-2) ISPN005009: Unexpected error before any request parameters read

          java.io.IOException: Broken pipe

                  at sun.nio.ch.FileDispatcher.write0(Native Method)

                  at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)

                  at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)

                  at sun.nio.ch.IOUtil.write(IOUtil.java:60)

                  at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)

                  at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$PooledSendBuffer.transferTo(SocketSendBufferPool.java:239)

                  at org.jboss.netty.channel.socket.nio.NioWorker.write0(NioWorker.java:470)

                  at org.jboss.netty.channel.socket.nio.NioWorker.writeFromUserCode(NioWorker.java:388)

                  at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:137)

                  at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76)

                  at org.jboss.netty.channel.Channels.write(Channels.java:632)

                  at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:70)

                  at org.jboss.netty.channel.Channels.write(Channels.java:611)

                  at org.jboss.netty.channel.Channels.write(Channels.java:578)

                  at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:251)

                  at org.infinispan.server.core.AbstractProtocolDecoder.exceptionCaught(AbstractProtocolDecoder.scala:261)

                  at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:432)

                  at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:331)

                  at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)

                  at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                  at java.lang.Thread.run(Thread.java:619)

           

          I am issueing the below command to start the hotrod server.

          sh ./startServer.sh -r hotrod -c /app/hotrod-config/configAPP7.xml -l 10.1.161.67 -p 7800 -i 20 -Dlog4j.configuration=/app/infinispan-5.1.0.CR1/etc/log4j.xml &

           

          Is this related to ISPN-1520?

           

          Could you pelase help me to solve this issue? Below is my new jgroup config file for TCP.