3 Replies Latest reply on Dec 16, 2013 3:57 AM by tremes

    Cache store properties in Infinispan 6.0

    networker

      Hi there,

       

      is there a new way to set properties on a cache store in Infinispan 6.0?  If, e.g., I want to set the database type or createTableOnStart properties on a jdbc-store (see configuration example below), the Infinispan server throws the following exceptions during startup:

       

      Cache store configuration example

      <!-- cache is based on a write-through cache store (i.e., passivation=false) -->
      <string-keyed-jdbc-store datasource="java:jboss/datasources/TeamsDS"
                                          passivation="false" preload="true" purge="false">
          <property name="databaseType">H2</property>
          <property name="createTableOnStart">true</property>
          <string-keyed-table prefix="JDG">
              <id-column name="id" type="VARCHAR"/>
              <data-column name="datum" type="BINARY"/>
              <timestamp-column name="version" type="BIGINT"/>
          </string-keyed-table>
      </string-keyed-jdbc-store>

       

      Exceptions thrown:

       

      (1) on databaseType setting:

       

      ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([

          ("subsystem" => "infinispan"),

          ("cache-container" => "local"),

          ("local-cache" => "teams")

      ]): org.infinispan.commons.CacheConfigurationException: Couldn't find a setter named [setDatabaseType] which takes a single parameter, for parameter databaseType on class [class org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder]

          at org.infinispan.configuration.parsing.XmlConfigHelper.setValues(XmlConfigHelper.java:450)

          at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:91)

          at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:9)

          at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.parseCommonAttributes(CacheAdd.java:874)

          ....

       

      (2) on createTableOnStart setting: (obviously the same problem)

       

      ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([

          ("subsystem" => "infinispan"),

          ("cache-container" => "local"),

          ("local-cache" => "teams")

      ]): org.infinispan.commons.CacheConfigurationException: Couldn't find a setter named [setCreateTableOnStart] which takes a single parameter, for parameter createTableOnStart on class [class org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder]

          at org.infinispan.configuration.parsing.XmlConfigHelper.setValues(XmlConfigHelper.java:450)

          at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:91)

          at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:9)

          at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.parseCommonAttributes(CacheAdd.java:874)

       

      Questions:

       

      1) Since I did not see these property settings in the JDG quickstart examples using Infinispan 6.0: are these property settings no more needed? I would wonder ..

      2) If still needed: how do I set these properties? I analyzed the org.infinispan.persistence.jdbc.configuration.JdbcStringBasedStoreConfigurationBuilder class. There is a method table() returning a StringTableManipulationConfigurationBuilder instance, which allows to set all these desired properties. E.g.:

       

          JdbcStringBasedStoreConfigurationBuilder cb = new JdbcStringBasedStoreConfigurationBuilder(null);
         cb.table().databaseType(DatabaseType.H2);
         cb.table().createOnStart(true);

       

      But how to set these table properties in the configuration file? Setting the property like follows does also not work:

       

      <property name="table.databaseType">H2</property>

       

      Upon startup, it looks for a method "setTable". Same pattern like above.

       

      Your help is kindly appreciated.

       

      Thanks,

      Roland