balax85
balax85

Reputation: 36

JCache with Infinispan in Wildfly 14 generate Unsatisfied dependencies for type InfinispanExtensionEmbedded with qualifiers @Default

I'm following some guide to set JCache in Wildfly 14 enviroment using as provider Infinispan.

I followed these steps : - I downloaded the wildfly module version 9.4.14 from Infinispan website - I copied the content of the zip in the module dir of Wildfly - I added to my application the file jboss-deployment-structure.xml - I added the interceptors to the beans.xml file on my application - I add the annotation @CacheResult to a function - I start Wildfly and I get the following error org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type InfinispanExtensionEmbedded with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private org.infinispan.cdi.embedded.AdvancedCacheProducer.infinispanExtension

I add information that can be useful. The application that I'm deploying on wildfly is an ear ant this is the structure that I'm using :

jboss-deployment-structure.xml :

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name="org.infinispan" slot="ispn-9.4" services="export"/>
            <module name="org.infinispan.cdi.embedded" slot="ispn-9.4" services="export"/>
            <module name="org.infinispan.jcache" slot="ispn-9.4" services="export"/>
        </dependencies>
  </deployment>
</jboss-deployment-structure>

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.1" bean-discovery-mode="all">
        <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>

With this standard configuration, I expect the interceptor start to defined in the beans.xml start to function, so I can use a default cache container in the application

Upvotes: 1

Views: 671

Answers (2)

Igors Patrejevs
Igors Patrejevs

Reputation: 1

You probably miss javax.enterprise.api dependency in javax.cache.api module

so get annotations didnt return javax.enterprise.util.Nonbinding and weld deployment return no such annotation

Upvotes: 0

netfisher777
netfisher777

Reputation: 21

org.infinispan.cdi.embedded and org.infinispan.jcache modules have SPI extensions inside them (jar/META-INF/services folder). Just add services="export" in module dependencies in jboss-deployment-structure.xml to enable them. Here is mine jboss-deployment-structure.xml:

<jboss-deployment-structure>
<deployment>
    <module-alias name="deployment.magic-blog" />
    <dependencies>
        <module name="org.infinispan.cdi.embedded" slot="ispn-9.4" export="true" services="export" />
        <module name="org.infinispan.jcache" slot="ispn-9.4" export="true" services="export" />
        <module name="javax.cache.api" slot="ispn-9.4" export="true"/>
    </dependencies>
</deployment>

Upvotes: 1

Related Questions