Migrate from WF 22 to WF 31 got error ISPN000436: Cache 'cusmycache' has been requested, but no matching cache configuration exists

387 views
Skip to first unread message

Nguyễn Toàn

unread,
May 21, 2024, 10:48:35 AM5/21/24
to WildFly
Hi all,
After upgrade from WF 22 to WF 31 with infinispan version 14.0.24.Final, it can't get the cache which we define in the standalone-full-ha.xml, it throws the error: ISPN000436: Cache 'cusmycache' has been requested, but no matching cache configuration exists
Can you help to resolve this issue?
This is my configuration in the standalone-full-ha.xml:
<subsystem xmlns="urn:jboss:domain:infinispan:14.0">
    <cache-container name="mycontainer-cache" default-cache="security">
        <transport-thread-pool max-threads="200"/>
        <replicated-cache name="cusmycache"  remote-timeout="60000">
            <locking isolation="READ_COMMITTED" acquire-timeout="290000" striping="false"/>
            <transaction mode="NON_DURABLE_XA" locking="OPTIMISTIC"/>
            <heap-memory size="-1"/>
            <state-transfer timeout="0"/>
        </replicated-cache>
    </cache-container>
</subsystem>
The file deployment is a "sar" file, in the applicationContext.xml will lookup the cache container and inject to the bean, then in the bean will get the cache name "cusmycache":
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
    ....>

    <bean id="sessionManager" class="com.my.cache.MyCacheMgt">
    <constructor-arg ref="cacheContainer"/>
    </bean>
     <jee:jndi-lookup id="cacheContainer" jndi-name="java:jboss/infinispan/container/mycontainer-cache" />
The class MyCacheMgt:
public MyCacheMgt(EmbeddedCacheManager cacheManager) {
  cacheManager.getCache("cusmycache"); //it throws exception at here: ISPN000436: Cache 'cusmycache' has been requested, but no matching cache configuration exists
}

Paul Ferraro

unread,
May 21, 2024, 4:16:26 PM5/21/24
to WildFly
Cache configurations are not installed unless they are specifically requested.  You could add a specific dependency on the requisite cache configuration, but it would be simpler to lookup your cache directly.
e.g.
<bean id="sessionManager" class="com.my.cache.MyCacheMgt">
<constructor-arg ref="cache"/>
</bean>
<jee:jndi-lookup id="cache" jndi-name="java:jboss/infinispan/cache/mycontainer-cache/cusmycache" />

Nguyễn Toàn

unread,
May 28, 2024, 7:23:41 AM5/28/24
to WildFly
Hi Paul,
Thank you for your support!
I tried to lookup directly as you suggested, but it still can't find the cache: javax.naming.NameNotFoundException: infinispan/cache/ mycontainer-cache/cusmycache  [Root exception is java.lang.IllegalStateException]
Can you point to the document that I can refer to for specific dependency on the requisite cache configuration?

Nguyễn Toàn

unread,
May 28, 2024, 7:23:51 AM5/28/24
to WildFly
Although it can't lookup the cache name, but when I cli and tried to add the same cache name under that cache container it said "it is already registered in context 'global'"
/subsystem=infinispan/cache-container=mycontainer-cache/local-cache=cusmycache:add
{
    "outcome" => "failed",
    "failure-description" => "WFLYCTL0436: Cannot register capability 'org.wildfly.clustering.cache.group.mycontainer-cache.cusmycache' at location '[
    (\"subsystem\" => \"infinispan\"),
    (\"cache-container\" => \"mycontainer-cache\"),
    (\"local-cache\" => \"cusmycache\")
]' as it is already registered in context 'global' at location(s) '[[
    (\"subsystem\" => \"infinispan\"),
    (\"cache-container\" => \"mycontainer-cache\"),
    (\"replicated-cache\" => \"cusmycache\")
]]'",
    "rolled-back" => true
}

On Wednesday, May 22, 2024 at 3:16:26 AM UTC+7 Paul Ferraro wrote:

Nguyễn Toàn

unread,
May 28, 2024, 7:23:58 AM5/28/24
to WildFly
This is a output when I try to read-resource of "cusmycache":
/subsystem=infinispan/cache-container=mycontainer-cache/replicated-cache=cusmycache:read-resource
{
    "outcome" => "success",
    "result" => {
        "batching" => false,
        "modules" => undefined,
        "remote-timeout" => 60000L,
        "statistics-enabled" => false,
        "component" => {
            "transaction" => undefined,
            "expiration" => undefined,
            "locking" => undefined,
            "backups" => undefined,
            "partition-handling" => undefined,
            "state-transfer" => undefined
        },
        "memory" => {"heap" => undefined},
        "store" => {"none" => undefined}
    }
}

On Wednesday, May 22, 2024 at 3:16:26 AM UTC+7 Paul Ferraro wrote:

dt pham

unread,
May 28, 2024, 1:28:52 PM5/28/24
to WildFly
Try to change your default-cache="security" to default-cache="cusmycache" since you don't have any cache "security" in your cache-container to see if it helps.

Nguyễn Toàn

unread,
May 29, 2024, 5:26:59 AM5/29/24
to WildFly
I fixed this issue.
The root cause is I forgot to change the package of annotation from javax.annotation.Resource to jakarta.annotation.Resource

Reply all
Reply to author
Forward
0 new messages