Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

CachingProvider Exceptions #12

Closed
boonbaluri opened this issue Dec 7, 2012 · 0 comments
Closed

CachingProvider Exceptions #12

boonbaluri opened this issue Dec 7, 2012 · 0 comments

Comments

@boonbaluri
Copy link

Hi,
I am new to caching, please help me solve cachingprovider exceptions.

I want to test this sample code.

String cacheName = "sampleCache";
CacheManager cacheManager = Caching.getCacheManager();
javax.cache.Cache cache = cacheManager.getCache(cacheName);
if (cache == null) {
cache = cacheManager.createCacheBuilder(cacheName).build();
}
cache.put("key","value for given key");
String fetchedcachevalue = cache.get("key");

System.out.println(fetchedcachevalue+" is the fetched cache value for given key");

in build path i path i gave cache-api-0.5.jar
When i run this, i got "No CachingProviders found in classpath." exception.

Then i gave "ehcache-jcache-1.5.0-0.5.jar" ,
then i got "Exception in thread "Main Thread" java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider net.sf.ehcache.jcache.JCacheCachingProvider could not be instantiated: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory"

then i gave "ehcache-core-2.6.2.jar" ," slf4j-api-1.6.1.jar" , "slf4j-jdk14-1.6.1.jar"
and got exception saying "Exception in thread "Main Thread" java.lang.NoClassDefFoundError: javax/cache/implementation/AbstractCacheManagerFactory"

then i gave "cache-ri-impl-0.5.jar" and got "Exception in thread "Main Thread" java.lang.IllegalStateException: Multiple CachingProviders found in classpath. There should only be one. CachingProviders found were: net.sf.ehcache.jcache.JCacheCachingProvider, javax.cache.implementation.RICachingProvider"

now if i remove either "ehcache-jcache-1.5.0-0.5.jar" or "cache-ri-impl-0.5.ja" , i am getting the same exception when run ,saying "Exception in thread "Main Thread" java.lang.NoClassDefFoundError: javax/cache/implementation/AbstractCacheManagerFactory".

and if i remove both "ehcache-jcache-1.5.0-0.5.jar" and "cache-ri-impl-0.5.ja" , then i am getting exception say "Exception in thread "Main Thread" java.lang.IllegalStateException: No CachingProviders found in classpath."

Please help me run this sample code.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants