Exception using mongodb as infinispan cache store

一曲冷凌霜 提交于 2020-02-15 12:49:48

问题


I want to use MongoDb as cacche store for the infinispan to persist the data evicted according to policy

i am posting the snippet of the code that is causing exception along with the exception

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);

exception that I am getting is

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

Any pointer will be of a great help Thnx.


回答1:


MongoDB was not updated after new persistence API was adopted in Infinispan. Try Infinispan 5.2.7.Final, maybe 5.3.0.Final or look into adaptor52x stuff. Or, even better, try to reimplement it using the new CacheWriter interface and issue a PR - the existing code should provide you some guidelines.



来源:https://stackoverflow.com/questions/22934135/exception-using-mongodb-as-infinispan-cache-store

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!