6 Replies Latest reply on May 28, 2010 4:21 PM by johnct

    Modeshape infinispan connector issue with infinispan cache loader?

      Using modeshape-jcr 1.2.0.Final, modeshape-connector-infinispan 1.2.0.Final and infinispan 4.0.0.Final

       

      I am able to create an infinispan cache with a JDBC based cache loader using the configuration provided here

       

      However, if I try to build a JCR repository backed by a cache loaded infinispan cache, I get the following error.

      org.infinispan.CacheException: Unable to invoke method public void org.infinispan.loaders.CacheLoaderManagerImpl.start() on object

      Full stack trace is attached.

       

      Here is my inifinispan-config.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="urn:infinispan:config:4.0">
          <global>
              <globalJmxStatistics enabled="true" jmxDomain="infinispan"
                  allowDuplicateDomains="false" />
          </global>
          <default>
              <jmxStatistics enabled="true" />
              <loaders>

                  <loader
                      class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore"
                      fetchPersistentState="false" ignoreModifications="false"
                      purgeOnStartup="false">
                      <properties>
                          <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE" />
                          <property name="idColumnName" value="ID_COLUMN" />
                          <property name="dataColumnName" value="DATA_COLUMN" />
                          <property name="timestampColumnName" value="TIMESTAMP_COLUMN" />
                          <property name="timestampColumnType" value="BIGINT" />
                          <property name="connectionFactoryClass"
                              value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory" />
                          <property name="connectionUrl"
                              value="jdbc:h2:mem:string_based_db;DB_CLOSE_DELAY=-1" />
                          <property name="userName" value="sa" />
                          <property name="driverClass" value="org.h2.Driver" />
                          <property name="idColumnType" value="VARCHAR(255)" />
                          <property name="dataColumnType" value="BINARY" />
                          <property name="dropTableOnExit" value="true" />
                          <property name="createTableOnStart" value="true" />
                      </properties>
                  </loader>
              </loaders>

          </default>
      </infinispan>

        • 1. Re: Modeshape infinispan connector issue with infinispan cache loader?

          Infinispan config did not show up in last post, attaching to this post.

          • 2. Re: Modeshape infinispan connector issue with infinispan cache loader?
            bcarothers

            It looks like your're missing infinispan-cachestore-jdbc.jar in your classpath.  I get the same error if I create an Infinispan CacheManager (outside of ModeShape) and try to load that file.

             

            I used this code to test it.

             

            CacheManager cacheManager1;

            String CONFIG_FILE = ...;

             

            FileInputStream fis = new FileInputStream(CONFIG_FILE);

            cacheManager1 = new DefaultCacheManager(fis);

            fis.close();

             

            Cache<String, String> cache1 = cacheManager1.getCache("");

             

            cacheManager1.stop();

            • 3. Re: Modeshape infinispan connector issue with infinispan cache loader?

              Thanks for the reply.

               

              I double checked that I have infinispan-cachestore-jdbc in my classpath.  Again, I am also able to create an infinispan cache outside of Modeshape.  I only see this error when I use that infinispan config as the source of a modeshape jcr repository.

               

              I'll modify your test code and post the results.

              • 4. Re: Modeshape infinispan connector issue with infinispan cache loader?

                It looks like the root cause of the error is this:

                 

                Caused by: org.infinispan.loaders.CacheLoaderException: cacheName needed in order to create table

                 

                I looked at the InfinispanSource api, but did not see a way to set a cacheName property to a named cache from the infinispan config.  Is there a way to do this?  Am I missing something in the jcr or source configuration?  Should the cacheName be defaulting to "default"?  Here is my test code.  Same infnispan config as before.

                 

                        final JcrConfiguration jcrConfig = new JcrConfiguration();
                        final String repoName = "repository";
                        jcrConfig.repositorySource("Infinispan").usingClass(
                                InfinispanSource.class).setProperty("cacheConfigurationName",
                                "/infinispan-config.xml");
                        jcrConfig.repository(repoName).setSource("Infinispan");
                        final JcrEngine jcrEngine = jcrConfig.build();
                        jcrEngine.start();
                        final JcrRepository repo = jcrEngine.getRepository(repoName);
                        jcrEngine.shutdown();

                • 5. Re: Modeshape infinispan connector issue with infinispan cache loader?
                  bcarothers

                  The connector looks for a cache with the same name as the workspace name.  It sounds like we would have to add some kind of WorkspaceNameMapper property to the connector to solve this globally, but you could probably work around this for now by setting the defaultWorkspaceName property on the connector to a non-empty string.

                  • 6. Re: Modeshape infinispan connector issue with infinispan cache loader?

                    That worked.  Thanks!

                     

                    For the record I switched to the JdbcBinaryCacheStore, since the keys are UUID's.