I'm trying to use the Infinispan JCache annotations within Wilfly 10. My Wildfly installation has the Wildfly-Camel extension (http://wildfly-extras.github.io/wildfly-camel/).

I would like to use method level caching:

@CacheResult
public Connector getConnector(String name) {
   ...
}

Relevant Maven dependencies of my app:

<dependencies>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.cache</groupId>
        <artifactId>cache-api</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.infinispan</groupId>
        <artifactId>infinispan-jcache</artifactId>
        <version>8.2.4.Final</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

My beans.xml:

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    version="1.2" bean-discovery-mode="annotated">
    <interceptors>
        <class>org.infinispan.jcache.annotation.InjectedCacheResultInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCachePutInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCacheRemoveEntryInterceptor</class>
        <class>org.infinispan.jcache.annotation.InjectedCacheRemoveAllInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheResultInterceptor</class>
        <class>org.infinispan.jcache.annotation.CachePutInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheRemoveEntryInterceptor</class>
        <class>org.infinispan.jcache.annotation.CacheRemoveAllInterceptor</class>
    </interceptors>
</beans>

However, I get the following error, when the application is being deployed:

WELD-001121: Member of array type or annotation type must be annotated @NonBinding:  [EnhancedAnnotatedMethodImpl] public abstract javax.cache.annotation.CacheResult.cachedExceptions()

Which is strange as all methods in javax.cache.annotation.CacheResult are annotated with @Nobinding

Any ideas?

Thank you!

1

There are 1 best solutions below

0
On
  • Have you tested behavior removing bean-discovery-mode="annotated" from beans.xml?
  • Have you assigned a cacheName to @CacheResult annotation?
  • It would be good to enable TRACE debug in standalone.xml to "org.infinispan"

I have it running with "bean-discovery-mode=all" (if not specified in beans.xml, takes this as default) and indicating only the last four interceptor classes: org.infinispan.jcache.annotation.Cache*

Hope it helps, keep posted.