Announcement Announcement Module
No announcement yet.
JBoss AS 7 configured Infinispan cache-container, how to Inject through JNDI? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JBoss AS 7 configured Infinispan cache-container, how to Inject through JNDI?

    Hi everyone

    For the setup:
    I have a JBoss Cluster setup AS 7.1.1 of Infinispan with the following contai
                <cache-container name="test-cache" default-cache="test_repl" start="EAGER">
                    <transport lock-timeout="60000"/>
                    <replicated-cache name="test_repl" mode="SYNC" start="EAGER">
                        <locking isolation="REPEATABLE_READ"/>
    I want to include this in my App by DI. Normally I would do a Resource lookup
    @Resource(lookup = "java:jboss/infinispan/container/test-cache")
    But no matter what I do this won't work. I tried with dedicated producers etc. but nothing worked. One of the most common errors I get is:
    Key type [null] of map [org.infinispan.Cache] must be assignable to [java.lang.String]
    And I do not get why. The code
    	@Resource(lookup = "java:jboss/infinispan/container/test-cache")
    	CacheContainer jbossCacheContainer;
    	public Cache jbossCache() {
    		return jbossCacheContainer.getCache();
    Already the single Resource Lookup throws him out with errors.

    I found this link which actually lead to the very first time that I was able to have a cache manager in my spring-based application. Before, nothing worked at all, and all examples I found were with custom configuration and not on the JBoss embedded cache-container.

    The problem with that implementation is that it is not Infinispan typed, but wraps everything in e.g. SpringCache etc. I could get the native implementations and wrap this in a custom class of course, but I am not sure if this is the best way. Shouldn't it be possible to grap the resource directly?

    I am sorry if I am missing something here, but I poked around the internet for several days now with a colleague, and the issue we have is the CDI based Infinispan way "does not compute" ^^ with the Spring way it seems.

    Any help is very appreciated. If you need more info, just let me know.

    Thanks in advance for any hint, Best
    Last edited by insanitydesign; Aug 1st, 2013, 07:28 AM. Reason: Typo

  • #2

    I do not want to push this thread, but after some views it seems no one has a good solution, so far at least. Maybe, any other direction someone can point me, too?