2012. december 19., szerda

Infinispan Cache Naming: Is "config" a Reserved Word?

Assume you have some EJBs, e.g. an EJB 3.1 singleton, and some Infinispan caches defined in you JBoss AS7 instance.
@Resource(mappedName = "java:jboss/infinispan/cache/mycontainer/mycache")
protected Cache<String, String> mycache;
The @Resource annotation here is referring to an Infinispan cache defined in JBoss AS7 as:
<cache-container name="mycontainer" default-cache="mycache">
    <transport lock-timeout="60000"/>
    <replicated-cache name="mycache" mode="SYNC" batching="true">
        <locking isolation="READ_COMMITTED" />
    </replicated-cache>
</cache-container>
Now if you try to add another cache named "config" as follows:
    <replicated-cache name="config" mode="SYNC" batching="true">
        <locking isolation="READ_COMMITTED" />
    </replicated-cache>
...and try to inject it into your bean:
@Resource(mappedName = "java:jboss/infinispan/cache/mycontainer/config")
protected Cache<String, String> config;
...you might encounter the following deployment error:
JBAS015870: Deploy of deployment "MyApplication" was rolled back with failure message {
...
"jboss.naming.context.java.module.\"MyApplication\".\"MyApplication\".env.\"com.example.MyBean\".config Missing[jboss.naming.context.java.jboss.infinispan.cache.mycontainer.config]",
...
}

Moreover you have no stack traces in the server log, so it's a trial and error process.

But... If you rename the cache to "myconfig", everything works as expected.

So is "config" a reserved word in Infinispan? If so, where is this documented? Anyways...

Nincsenek megjegyzések:

Megjegyzés küldése