请求hazelcast jcache提供程序时未找到HazelcastClientCachingProvider类异常

时间:2014-10-30 16:31:11

标签: java caching hazelcast jcache

当我尝试使用基于Hazelcast的JCache(即JSR 107)实现时,我发出了一个奇怪的警告,如下所示(original sample code):

// Explicitly retrieve the Hazelcast backed javax.cache.spi.CachingProvider
CachingProvider cachingProvider = Caching.getCachingProvider(name);
// Retrieve the javax.cache.CacheManager
CacheManager cacheManager = cachingProvider.getCacheManager("com.hazelcast.cache.impl.HazelcastCachingProvider");

以下是已记录的消息:

oct. 30, 2014 5:17:59 PM com.hazelcast.cache.impl.HazelcastCachingProvider
WARNING: Could not load client CachingProvider! Fallback to server one... java.lang.ClassNotFoundException: com.hazelcast.client.cache.impl.HazelcastClientCachingProvider

为什么要尝试加载HazelcastClientCachingProvider,我会要求com.hazelcast.cache.impl.HazelcastCachingProvider。我使用了错误的JCache提供程序吗?

1 个答案:

答案 0 :(得分:3)

HazelcastCachingProvider只是一个自动选择基于客户端或服务器库CachingProvider的委托。

对于最近的3.4快照,HazelcastCachingProvider也被移至com.hazelcast.cache.HazelcastCachingProvider。有关新文档,请参阅刚刚起草的3.4版文档版本:https://github.com/hazelcast/hazelcast/blob/master/hazelcast-documentation/src/JCache.md

你会看到它变得更久了:)