2 Replies Latest reply on Nov 17, 2012 3:07 AM by Tristan Tarrant

    Any one know how to get infinispan to start when JBoss does?

    Paul Hinds Newbie

      I have an infinispan cache defined in the standalone.xml (one comes by default) but it does not start when JBoss does, presumably it starts "on demand".

       

      Any idea how I demand that it starts?

       

      I hav etried to look it up in JNDI but in the console it is not there (yet).

       

      I have added a dependency on "org.infinispan export" in my manifest.

       

      I tried to reference it with the following in a class loaded by Spring.

       

      @Resource(lookup="java:jboss/infinispan/container")  but that will not compile requires JDK7

       

      @Resource(name="java:jboss/infinispan/container")  does not work

       

      the names are guesswork, I'll admit, I did try infinispan/[container name] first.

       

       

      P

        • 1. Re: Any one know how to get infinispan to start when JBoss does?
          Paul Hinds Newbie

          OK a reply to myself, since I fixed this one.

           

          Add start="EAGER" to both the cache-container and the cache.

           

          <cache-container default-cache="repl" jndi-name="infinispan/container" start="EAGER">

              <transport lock-timeout="60000"/>

              <replicated-cache name="repl" mode="ASYNC" start="EAGER" batching="true" jndi-name="MyCache">

                  <eviction strategy="LRU"/>

                  <file-store/>

              </replicated-cache>

          </cache-container>

           

          N.B. in JNDI the container and the cache are NOT related, infact you can not make the Cache a sub-name of the container, it must have its own name.

           

          The above config is accessible with

           

          java:jboss/infinispan/container

          and

          java:jboss/MyCache

           

          If anything fails on boot, the names do not appear in JNDI, but with EAGER they and a valid config they appear directly on boot and can be looked up in Spring.

           

          <jee:jndi-lookup id="infinispan" jndi-name="java:jboss/MyCache" />

          • 2. Re: Any one know how to get infinispan to start when JBoss does?
            Tristan Tarrant Master

            I was going to provide an answer to this, but you seem to have discovered the solution by yourself.