11 Replies Latest reply on Feb 19, 2012 5:59 AM by lukaszk

    Is JBoss 7.1 and BDBJE Cache Store supported

    oranheim

      Hi,

       

      Is BDBJE Cache Store supported in JBoss 7.1.CR1 and by Infinispan.

       

      I couldn't find any configuration documentation at: https://docs.jboss.org/author/display/ISPN/CacheLoaders

       

      Ove

        • 1. Re: Is JBoss 7.1 and BDBJE Cache Store supported
          galder.zamarreno

          The BDBJE cache store should work with AS 7.1 but you will need to add the jars yourself, including the bdbje jar and the cache store impl jar.

           

          Look at modules/org/infinispan/cachestore/jdbc/main directory in 7.1 CR1b to see what you need to do to add the libraries for the cache store...etc.

           

          Finally, to configure the cache store, your best source is https://github.com/galderz/jboss-as/blob/master/clustering/infinispan/src/test/resources/subsystem-infinispan.xml and in particular:

           

          <store class="org.infinispan.loaders.file.FileCacheStore" fetch-state="true" passivation="true" preload="false" purge="true" shared="false" singleton="false">

             <property name="location">${java.io.tmpdir}</property>

          </store>

           

          Basically, substitute the class name for the BDBJE cache store one and add the corresponding properties.

           

          If you have any probs, let us know and we'll help you along. Btw, make a note of all the steps so that we can add it to the docu in the future

          • 2. Re: Is JBoss 7.1 and BDBJE Cache Store supported
            oranheim

            Hi Galder,

             

            Looking at the subsystem-infinispan.xml and under ./modules/org/infinispan/ there is nothing much to explain how to rig up the BDBJE Cache Store. Neither the JDBC nor File system cache store is applicable to high performance production deployment, that requires transaction support.

             

            Are there any other sources to get an example on how to use and deploy?

             

            Best,

            Ove

            • 3. Re: Is JBoss 7.1 and BDBJE Cache Store supported
              galder.zamarreno

              @Ove, you only need to focus on the XML part I highlighted and apply bdbje settings. For example:

               

              <store class="org.infinispan.loaders.bdbje.BdbjeCacheStore" fetch-state="true" passivation="true" preload="false" purge="true" shared="false" singleton="false">

                 <property name="location">${java.io.tmpdir}</property>

              </store>

               

              That's it - You can add more properties such as the ones indicated in: http://docs.jboss.org/infinispan/5.1/apidocs/org/infinispan/loaders/bdbje/BdbjeCacheStore.html

               

              Apart from the XML, you need to hook up the jars as explained in the last post. That means creating:

               

              1. A modules/org/infinispan/cachestore/bdbje/main folder in your AS 7.1 installation.

              2. Adding infinispan-cachestore-bdje-5.1.0.CR1.jar in that folder

              3. Create a module.xml in that folder with:

               

              <module xmlns="urn:jboss:module:1.1" name="org.infinispan.cachestore.bdbje">

                  <resources>

                      <resource-root path="infinispan-cachestore-bdbje-5.1.0.CR1.jar"/>

                      <!-- Insert resources here -->

                  </resources>

               

                  <dependencies>

                      <module name="javax.api"/>

                      <module name="javax.transaction.api"/>

                      <module name="org.infinispan"/>

                      <module name="org.jboss.logging"/>

                      <module name="com.sleepycat.je"/>

                  </dependencies>

              </module>

               

              4. Create modules/com/sleepycat/je/main folder and repeat the same process but for the actual BDBJE jars....

              • 4. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                galder.zamarreno

                Of course, this assumes that you have read https://docs.jboss.org/author/display/ISPN/Getting+Started+Guide+-+JBoss+AS+7 and you understand how to add a cache container in AS7. The store XML part is configured in your cache container.

                • 5. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                  oranheim

                  Excellent!

                   

                  I'll give it a try!

                  • 6. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                    lukaszk

                    Hi,

                    I am just trying to configure bdbje infinispan cache store: I add bdbje cache store as suggested, I also add com.sleepycat.je module.

                    Next I add this line <module name="org.infinispan.cachestore.bdbje"/> into modules\org\jboss\as\clustering\infinispan\main\module.xml

                    When I run server I am getting ClassNotFoundException:

                     

                    15:48:16,728 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) JBAS014612: Operation ("add") failed - address: ([

                        ("subsystem" => "infinispan"),

                        ("cache-container" => "business-unit-cache-container"),

                        ("local-cache" => "unit-alias")

                    ]): java.lang.IllegalArgumentException: org.infinispan.loaders.bdbje.BdbjeCacheStore is not a valid cache store

                        at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.buildCacheStore(CacheAdd.java:460)

                        at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.processModelNode(CacheAdd.java:359)

                        at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.performRuntime(CacheAdd.java:89)

                        at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:50) [jboss-as-controller-7.1.0.CR1b.jar:7.1.0.CR1b]

                        at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:359) [jboss-as-controller-7.1.0.CR1b.jar:7.1.0.CR1b]

                        at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:254) [jboss-as-controller-7.1.0.CR1b.jar:7.1.0.CR1b]

                        at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:190) [jboss-as-controller-7.1.0.CR1b.jar:7.1.0.CR1b]

                        at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:311) [jboss-as-controller-7.1.0.CR1b.jar:7.1.0.CR1b]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_25]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_25]

                        at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]

                        at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

                    Caused by: java.lang.ClassNotFoundException: org.infinispan.loaders.bdbje.BdbjeCacheStore from [Module "org.infinispan:main" from local module loader @52c4c57 (roots: C:\DevServer\jboss-as-7.1.0.CR1b\modules)]

                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.0.CR6]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.0.CR6]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.0.CR6]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.0.CR6]

                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.0.CR6]

                        at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.buildCacheStore(CacheAdd.java:452)

                        ... 11 more

                     

                    I am not sure why this class is not found since it is added as module and as dependency.

                    Maybe someone will have idea where else I should add some dependency ?

                    • 7. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                      forever-pi

                      I guess you don't add infinispan-cachestore-bdbje.jar in {infinispan}/modules/cachestores/bdbje

                      • 8. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                        lukaszk

                        yes, I add it there.

                        In debug mode at line 452 of class

                        org.jboss.as.clustering.infinispan.subsystem.CacheAdd

                        I even invoke Class.forName(className) and it returns correct class,

                        but CacheStore.class.getClassLoader().loadClass(className) does not work.

                        • 9. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                          galder.zamarreno

                          My guess is that if you add the dependency to modules\org\jboss\as\clustering\infinispan\main\module.xml correctly as <module name="org.infinispan.cachestore.bdbje"/>, then you need to verify that you have a folder called: modules/org/infinispan/cachestore/bdbje and you have a the a main/ folder within it with the jar(s) and the right module.xml

                           

                          The folder name suggested by @Forever does not seem correct.

                          • 10. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                            galder.zamarreno

                            Actually, that's not right, you need to modify modules/org/infinispan/main/module.xml and put the <module name="org.infinispan.cachestore.bdbje"/> there, not in the AS7 Infinsipan clustering subsystem.

                             

                            Alternatively, drop the bdbje jars into modules/org/infinispan/main folder and list them in the modules/org/infinispan/main/module.xml

                            • 11. Re: Is JBoss 7.1 and BDBJE Cache Store supported
                              lukaszk

                              I create such module:

                              <module xmlns="urn:jboss:module:1.1" name="org.infinispan.cachestore.bdbje">
                                  <resources>
                                      <resource-root path="infinispan-cachestore-bdbje-5.1.1.FINAL.jar"/>
                                      <resource-root path="je-4.0.92.jar"/>
                                  </resources>
                                  <dependencies>
                                      <module name="javax.api"/>
                                      <module name="javax.transaction.api"/>
                                      <module name="org.infinispan"/>
                                      <module name="org.jboss.logging"/>
                                  </dependencies>
                              </module>
                              

                              I add dependecy like you suggested in modules/org/infinispan/main/module.xml and ... it works!!!

                               

                              Thanks Galder.