Why would this not work ? - No CachingProviders have been configured

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why would this not work ? - No CachingProviders have been configured

Narahari Lakshminarayana
Friends:

I have the following code that is not working.

@Grapes(
    @Grab(group='org.mnode.ical4j', module='ical4j', version='3.0.20')
)
@Grapes(
    @Grab(group='javax.cache', module='cache-api', version='1.1.1')
)
@Grapes(
    @Grab(group='com.github.ben-manes.caffeine', module='caffeine', version='2.8.6')
)

import javax.cache.spi.*;
import javax.cache.*;
import javax.cache.configuration.*;
import com.github.benmanes.caffeine.*;

CachingProvider cachingProvider = Caching.getCachingProvider();

I get the following error

javax.cache.CacheException: No CachingProviders have been configured

===================

Not sure what is wrong in the above code.

Please help.

-Narahari


Reply | Threaded
Open this post in threaded view
|

Re: Why would this not work ? - No CachingProviders have been configured

Simon Tost
Hi Narahari,


I cannot speak with authority, but maybe you also want to load the
jcache api dependency of caffeine as well.
("@Grab(group='com.github.ben-manes.caffeine', module='jcache',
version='2.8.6')") [1]

And peeking at one of their test cases, you may need a call it like:
Caching.getCachingProvider(CaffeineCachingProvider.class.name)
[2]

But I did not test this.


Hope it helps,
Simon


PS: This is not really a question specific to Groovy. Maybe a place like
https://stackoverflow.com/ is more appropriate for general Java questions.



[1] See https://github.com/ben-manes/caffeine at the bottom
[2]
https://github.com/ben-manes/caffeine/blob/master/jcache/src/test/java/com/github/benmanes/caffeine/jcache/CacheManagerTest.java






On 28.11.20 00:34, Narahari Lakshminarayana wrote:

> Friends:
>
> I have the following code that is not working.
>
> @Grapes(
>     @Grab(group='org.mnode.ical4j', module='ical4j', version='3.0.20')
> )
> @Grapes(
>     @Grab(group='javax.cache', module='cache-api', version='1.1.1')
> )
> @Grapes(
>     @Grab(group='com.github.ben-manes.caffeine', module='caffeine',
> version='2.8.6')
> )
>
> import javax.cache.spi.*;
> import javax.cache.*;
> import javax.cache.configuration.*;
> import com.github.benmanes.caffeine.*;
>
> CachingProvider cachingProvider = Caching.getCachingProvider();
>
> I get the following error
>
> javax.cache.CacheException: No CachingProviders have been configured
>
> ===================
>
> Not sure what is wrong in the above code.
>
> Please help.
>
> -Narahari
>
>


--
Simon Tost * [hidden email] * +49-176-17654629
TNG Technology Consulting GmbH, Beta-Str. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Gerhard Müller, Dr. Robert Dahlke
Sitz: Unterföhring * Amtsgericht München * HRB 135082