-
1. Re: Unexpected behaviour of infinispan local cache in Wildfly 10.
pferraro Apr 26, 2016 10:44 AM (in response to valsitsar)Injecting the cache container doesn't imply that the "myCache" is available - thus the cache that is returned by container.getCache("myCache") was not built using the configuration you expect. Use this instead:
@Resource(lookup = "java:jboss/infinispan/cache/myContainer/myCache") private Cache<String, String> cache;
The lifecycle of the cache resource will be handled by the container.
-
2. Re: Unexpected behaviour of infinispan local cache in Wildfly 10.
barbazor Apr 26, 2016 6:38 PM (in response to pferraro)Hi,
I read this post and this JIRA https://issues.jboss.org/browse/WFLY-5959, also https://developer.jboss.org/thread/259151 and i get
Caused by: javax.naming.NameNotFoundException: infinispan/cache/myCache/cachedb
This is my code:
@Singleton @Startup @AccessTimeout(value = 5, unit = TimeUnit.MINUTES) public class ProcessManager { @Resource(lookup = "java:jboss/infinispan/cache/myCache/cachedb") private Cache<String, String> cache;
I change lookup parameter with:
java:jboss/infinispan/cache/myCache/cachedb java:jboss/infinispan/cache/myCache java:jboss/infinispan/container/myCache/cachedb java:jboss/infinispan/container/myCache
i get another exceptions but finally it didn't work.
In ear META-INF i add:
Dependencies: org.infinispan export
This is my standalone.xml configuration:
<cache-container name="myCache" default-cache="cachedb"> <local-cache name="cachedb" jndi-name="java:/jboss/infinispan/cache/myCache/cachedb"> <transaction locking="PESSIMISTIC" mode="NON_XA"/> </local-cache> </cache-container>
I try with and without jndi-name. Also i try <resource-env-ref> and it didn't work.
Any help will be appreciated.
-
3. Re: Unexpected behaviour of infinispan local cache in Wildfly 10.
barbazor Apr 26, 2016 7:10 PM (in response to barbazor)I make it works, i change javax.inject.singleton by javax.ejb.singleton. I think @Startup doesn't work with javax.inject.singleton and when i change to ejb, it initialize the singleton at application startup.