0 Replies Latest reply on Apr 8, 2014 9:35 AM by Amit Hora

    Exception while using MongoDb as CacheStore for Infinispan

    Amit Hora Newbie

      Hi All,

       

      I am trying to use mongodb as a cache store for infinispan but getting exceptions

       

      Code--

      ConfigurationBuilder b = new ConfigurationBuilder();

          b.loaders().addStore(

          MongoDBCacheStoreConfigurationBuilder.class).host( "localhost" )

          .port( 27017 )

          .timeout( 1500 )

          .acknowledgment( 0 )

          .username( "" )

          .password( "" )

         

          .database( "infinispan_cachestore" )

          .collection( "entries" );

          

          final Configuration config = b.build();

          MongoDBCacheStoreConfiguration store = (MongoDBCacheStoreConfiguration) config.loaders().cacheLoaders().get(0);

         

          EmbeddedCacheManager cacheManager=new DefaultCacheManager();

          cacheManager.defineConfiguration("usersCache", config);

          //DefaultCacheManager manger=new DefaultCacheManager(config);

          Cache<String, String> usersCache = cacheManager.getCache("usersCache");

          //ch.put("myname", "amit");*/

       

       

      Exception that i am getting

       

      Exception in thread "main" org.infinispan.CacheException: Unable to invoke method public void org.infinispan.loaders.CacheLoaderManagerImpl.start() on object of type CacheLoaderManagerImpl

          at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:207)

          at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889)

          at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:658)

          at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:647)

          at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:550)

          at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:221)

          at org.infinispan.CacheImpl.start(CacheImpl.java:691)

          at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:685)

          at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:648)

          at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:544)

          at com.infini.demo.DemoWithInfi5.main(DemoWithInfi5.java:31)

      Caused by: org.infinispan.CacheException: Unable to start cache loaders

          at org.infinispan.loaders.CacheLoaderManagerImpl.start(CacheLoaderManagerImpl.java:163)

          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.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:205)

          ... 10 more

      Caused by: java.lang.IllegalArgumentException: Cannot load null class!

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

          at org.infinispan.loaders.CacheLoaderManagerImpl.createCacheLoader(CacheLoaderManagerImpl.java:346)

          at org.infinispan.loaders.CacheLoaderManagerImpl.createCacheLoader(CacheLoaderManagerImpl.java:336)

          at org.infinispan.loaders.CacheLoaderManagerImpl.start(CacheLoaderManagerImpl.java:149)

          ... 15 more