2014-04-08 47 views
2

我想使用MongoDB的作为cacche存储中的Infinispan根据政策异常使用的MongoDB作为Infinispan的缓存存储

我张贴了与异常

一起造成异常的代码的片段坚持清除的数据
ConfigurationBuilder config = new ConfigurationBuilder(); 
MongoDBCacheStore strgBuilder = new MongoDBCacheStore(); 
ConfigurationBuilder b = new ConfigurationBuilder(); 
b.persistence() 
.addStore(MongoDBCacheStoreConfigurationBuilder.class) 
.host("localhost") 
.port(27017) 
.timeout(1500) 
.acknowledgment(0) 
.username("") 
.password("") 
.database("infinispan_cachestore") 
.collection("entries"); 
/* DefaultCacheManager manager=new DefaultCacheManager(b.build()); 
Cache ch=manager.getCache(); 
ch.put("username","sogani"); */ 

final Configuration configcache = b.build(); 
MongoDBCacheStoreConfiguration store = (MongoDBCacheStoreConfiguration) configcache.persistence().stores().get(0); 

例外,我得到的是

java.lang.NoSuchMethodException: org.infinispan.loaders.mongodb.configuration.MongoDBCacheStoreConfigurationBuilder. 

任何指针将是一个很大的帮助 日Thnx。

回答

1

在Infinispan中采用新的持久性API后,MongoDB未更新。尝试Infinispan 5.2.7.Final,也许5.3.0.Final或调查adaptor52x的东西。或者,甚至更好,尝试使用新的CacheWriter接口重新实现它并发布PR - 现有代码应该为您提供一些指导。