2 Replies Latest reply on Jun 12, 2018 12:58 PM by pferraro

    WF11 -> WF13, infinispan upgrade problem

    hannez82

      We are trying to upgrade from wildfly 11 to wildfly 13 but can't understand how we should inject our caches that we have defined in the conf. The old conf looks like this:

       

      <cache-container name="latest_xx_status" default-cache="default" module="org.wildfly.clustering.server" jndi-name="java:jboss/infinispan/latest_xx_status">

         <transport lock-timeout="60000"/>

         <replicated-cache name="default" jndi-name="java:jboss/infinispan/latest_xx_status/cache" mode="ASYNC" remote-timeout="1000">

         <transaction locking="OPTIMISTIC" mode="NONE" stop-timeout="1000"/>

         <eviction strategy="NONE"/>

         </replicated-cache>

      </cache-container>

       

      And the code looks like this:

       

      @Resource(lookup = "java:jboss/infinispan/latest_xx_status/cache")

       

      However, with the 6.0 namespace of inifinspan we can no longer define jndi-name for the cache and we can't find it anyway in the jndi-tree. We can find the cache-container though... but we want to inject the cache directly.

       

      How should we resolve this?

       

      / Hannes

        • 1. Re: WF11 -> WF13, infinispan upgrade problem
          pmm

          We had a similar issue, here is how we solved it:

          • 2. Re: WF11 -> WF13, infinispan upgrade problem
            pferraro

            To optimize the portability of your code, I recommend that you access your Infinispan cache via a resource reference, rather referencing a vendor specific namespace.  To do this, add the following to your deployment descriptor:

             

            <resource-env-ref>
              <resource-env-ref-name>cache/latest_xx_status</resource-env-ref-name>
              <resource-env-ref-type>org.infinispan.Cache</resource-env-ref-type>
              <lookup-name>java:jboss/infinispan/cache/latest_xx_status/default</lookup-name>
            </resource-env-ref>
            

             

            Then reference the cache using:

             

            @Resource(name="cache/latest_xx_status")
            private Cache<?, ?> cache;