1 Reply Latest reply on Oct 9, 2013 4:20 AM by rhusar

    Using Infinispan's EmbeddedCacheManager with Openshift

    ayrx

      I am trying to use Infinispan as a cache for my Java application hosted with JBoss AS 7 on Openshift.

      I have the following cluster configuration in standalone.xml.

      <cache-container name="cluster" aliases="ha-partition" default-cache="default"> 
        <transport lock-timeout="60000"/> 
        <replicated-cache name="default" mode="SYNC" batching="true" start="EAGER"> 
          <locking isolation="REPEATABLE_READ"/> 
        </replicated-cache>
      </cache-container>
      
      


      I tried accessing the cache with the following code snippet.

      @Resource(lookup = "java:jboss/infinispan/container/cluster") 
      EmbeddedCacheManager container;  
      
      
      private Cache<String, Integer> foo = container.getCache("foo", true);
      
      


      However, a NullPointerException is thrown on the line where with container.getCache. This is presumably because the lookup failed to find a value for container.

      What am I doing wrong?

      http://stackoverflow.com/questions/19220652/using-infinispans-embeddedcachemanager-with-openshift

        • 1. Re: Using Infinispan's EmbeddedCacheManager with Openshift
          rhusar

          Few things:

           

          1. Don't use the "cluster" cache container, as it's used for internal AS data. Define your own.
          2. Add jndi-name attribute to the cache-container element
          3. Make sure you don't package Infinispan jars yourself, but set the dependency in the manifest
          4. Also, make sure you have configured the transport that works on OpenShift
          5. Check the logs..
          1 of 1 people found this helpful