0 Replies Latest reply on May 18, 2015 6:16 AM by Karan soni

    Issue in accessing Remote cache manager in Infinispan

    Karan soni Newbie

      Hi, I am trying to access cache remotely but facing in exception while initiating RemoteCacheManager. following is code and exception

       

       

      Code

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      import java.net.URL;

      import java.util.Properties;

      import org.infinispan.client.hotrod.RemoteCache;

      import org.infinispan.client.hotrod.RemoteCacheManager;

       

       

      public class QuickStart {

      public static void main(String[] args) {

        RemoteCacheManager cacheContainer = new RemoteCacheManager("10.0.0.28:1600");

       

        RemoteCache<String, String> cache = cacheContainer.getCache("test");

       

       

        //now add something to the cache and make sure it is there

        cache.put("car", "ferrari");

        if(cache.get("car").equals("ferrari")){

         System.out.println("Cache Hit!");

        } else {

         System.out.println("Cache Miss!");

        }

        //remove the data

        cache.remove("car");

        cacheContainer.stop();

      }

      }

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

       

       

       

      Exception

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      Exception in thread "main" java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

      Caused by: org.infinispan.CacheConfigurationException: Unable to instantiate class org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory

              at org.infinispan.util.Util.loadClass(Util.java:101)

              at org.infinispan.util.Util.getInstance(Util.java:222)

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

              at org.infinispan.client.hotrod.RemoteCacheManager.<init>(RemoteCacheManager.java:349)

              at org.infinispan.client.hotrod.RemoteCacheManager.<init>(RemoteCacheManager.java:363)

              at org.infinispan.client.hotrod.RemoteCacheManager.<init>(RemoteCacheManager.java:356)

              at QuickStart.main(QuickStart.java:23)

              ... 5 more

      Caused by: java.lang.ClassNotFoundException: org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory

              at java.net.URLClassLoader$1.run(Unknown Source)

              at java.net.URLClassLoader$1.run(Unknown Source)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(Unknown Source)

              at java.lang.ClassLoader.loadClass(Unknown Source)

              at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

              at java.lang.ClassLoader.loadClass(Unknown Source)

              at java.lang.Class.forName0(Native Method)

              at java.lang.Class.forName(Unknown Source)

              at org.infinispan.util.Util.loadClassStrict(Util.java:138)

              at org.infinispan.util.Util.loadClass(Util.java:99)

              ... 11 more

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------