Search code examples
jbosswildflyjndiinfinispan

jndi-name of infinispan cache container is not valid anymore with wildfly 15


after migrating from jboss as 7 to wildfly 15 jndi-name of infinispan cache container is not valid anymore with wildfly 15.

OPVDX001: Validierungsfehler in standalone.xml ---------------------------------
|
|  344: 
|  345:         <subsystem xmlns="urn:jboss:domain:infinispan:7.0">
|  346:             <cache-container jndi-name="java:jboss/infinispan/my-container" name="my-container" module="org.infinispan.hibernate-cache">
|                                           "cache-container"
|                                    ^^^^ "jndi-name" ist kein zulässiges Attribut für das Element
|                                         
|                                         Die folgenden Attribute sind hier zulässig: aliases, default-cache,
|                                           module, name, statistics-enabled 
|
|  347:                 <local-cache  name="my-other-container">
|  348:                     <expiration lifespan="900000" />
|  349:                 </local-cache>
|
| "jndi-name" ist zulässig bei Elementen: 

is there a replacement for jndi-name?


Solution

  • Property "jndi-name" is deleted. Just declare the property "name".

    Then you can lookup the container using the pattern below. The container is available in JDNI context with this lookup path: java:jboss/infinispan/container/<your-container-name>/

    Sample config:

    <cache-container name="my-container" module="org.infinispan.hibernate-cache">
        <local-cache name="lala" >
          <object-memory size="10000"/>
          <expiration max-idle="100000"/>
        </local-cache>
    </cache-container>
    

    instead of

    @Resource(lookup = "java:jboss/infinispan/my-container")
    private EmbeddedCacheManager cacheManager;
    

    use

    @Resource(lookup = "java:jboss/infinispan/container/my-container/"
    private EmbeddedCacheManager cacheManager;
    

    or direct inject cache

    // java:jboss/infinispan/cache/<name-of-container>/<name-of-cache>
    @Resource(lookup = "java:jboss/infinispan/cache/my-container/lala")
    private Cache<String, PrincipalEntity> userCache;
    

    see also:

    wildscribe subsystem infinispan

    related issue

    WFLY-9463