6 Replies Latest reply on Aug 6, 2012 8:35 PM by thomaswkim

    TcpTransportFactory cannot be cast to TransportFactory

    thomaswkim

      I'm struggling with the error that is org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory cannot be cast to org.infinispan.client.hotrod.impl.transport.TransportFactory

      at org.infinispan.client.hotrod.RemoteCacheManager.start(RemoteCacheManager.java:464)

       

       

      @Override

         public void start() {

            ...

       

            String factory = config.getTransportFactory();

            transportFactory = (TransportFactory) getInstance(factory, classLoader);

            ...

       

            started = true;

         }

       

       

      TransportFactory is an Interface, I think it should work anyway.

       

      because I'm using this code in a standalone maven project, it works well.

       

        Properties prop = new Properties();

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

       

        RemoteCacheManager cachemgr = new org.infinispan.client.hotrod.RemoteCacheManager(prop);

        cachemgr.start();

                                    RemoteCache<Object, Object> remotecache = a.getCache();

       

      but if I try to use this on Infinispan 5.1.5 and JBOSS 7.1. I'm getting this error.

       

      I'm thinking this is a problem related to Conflicts of Version or Modules in JBoss.

       

      please give me any ideas.

       

      Thanks in Advance.

        • 1. Re: TcpTransportFactory cannot be cast to TransportFactory
          mlinhard

          Hi Thomas,

           

          what kind of setting are you creating a RemoteCacheManager in ?

          Is it inside of a war/ear deployment ?

           

          m.

          • 2. Re: TcpTransportFactory cannot be cast to TransportFactory
            thomaswkim

            Hi Michal,

             

            Thanks for replying.

             

            this is the setting

             

            infinispan.client.hotrod.transport_factory = org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory

            infinispan.client.hotrod.server_list = 127.0.0.1:11222

            infinispan.client.hotrod.marshaller = org.infinispan.marshall.jboss.GenericJBossMarshaller

            infinispan.client.hotrod.async_executor_factory = org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory

            infinispan.client.hotrod.default_executor_factory.pool_size = 1

            infinispan.client.hotrod.default_executor_factory.queue_size = 10000

            infinispan.client.hotrod.hash_function_impl.1 = org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV1

            infinispan.client.hotrod.tcp_no_delay = true

            infinispan.client.hotrod.ping_on_startup = true

            infinispan.client.hotrod.request_balancing_strategy = org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy

            infinispan.client.hotrod.key_size_estimate = 64

            infinispan.client.hotrod.value_size_estimate = 512

            infinispan.client.hotrod.force_return_values = false

            ## below is connection pooling config

            maxActive=10

            maxTotal = 10

            maxIdle = 100

            testOnBorrow=true

             

            and it is in the war deployment.

            • 3. Re: TcpTransportFactory cannot be cast to TransportFactory
              mlinhard

              Hi Thomas,

               

              I couldn't replicate your issue, I just successfully tried to deploy a sample app war to JBoss 7.1.1.Final that uses Infinispan 5.1.5.FINAL RemoteCacheManager and it worked (Even with your hotrod properties). Can you send logs of your JBoss AS that the error occurs on ? Or isolate the issue into a simple small app that I could rerun and investigate ?

               

              m.

              1 of 1 people found this helpful
              • 4. Re: TcpTransportFactory cannot be cast to TransportFactory
                genman

                Smells like a classloader issue to me. I would take a look at your classpath and see if you don't have two copies of this class in two different jar files.

                1 of 1 people found this helpful
                • 5. Re: TcpTransportFactory cannot be cast to TransportFactory
                  mircea.markus

                  Agreed with Elias. If the given class is loaded twice, with different ClassLoaders then a cast from one instance to the other will fail. Most likely these were loaded with different class loaders.

                  • 6. Re: TcpTransportFactory cannot be cast to TransportFactory
                    thomaswkim

                    Hi Michal, Thanks a lot.

                     

                    I'll try it more as you suggested, let you know how it goes.