2014-04-08 44 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 - 現有代碼應該爲您提供一些指導。