1 Reply Latest reply on Mar 11, 2010 2:36 PM by Mircea Markus

    Problem using JdbcStringBasedCacheStore

    Sprightee s Newbie

      Hi,

       

         I need to persist data into database instead of a file store.

      I'm using the JdbcStringBasedCacheStore.

       

      Src :

       

       


      import java.io.IOException;

      import org.infinispan.Cache;
      import org.infinispan.manager.CacheManager;
      import org.infinispan.manager.DefaultCacheManager;


      public class TestInfinispan {

       

      public static void main(String[] args)
      {
        CacheManager cacheManager = null ;
        try {
        
         cacheManager = new DefaultCacheManager("C:\\MyWorkspace\\Infinispan\\conf\\sample-configuration.xml");
        
         Cache cache = cacheManager.getCache("CacheStore");
         cache.put("name1", "aaa");
         System.out.println(cache.get("name1"));
       
        } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
        }
          
      }

      }

       

      Configuration file :

      <

       

      namedCache name="CacheStore">

       

       

      <loaders passivation="false" shared="false" preload="true">

       

      <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:oracle:thin:@14.167.10.81:1521:TESTDB;DB_CLOSE_DELAY=-1"/>

       

      <property name="userName" value="user"/>

       

      <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>

       

      <property name="idColumnType" value="VARCHAR(255)"/>

       

      <property name="dataColumnType" value="BINARY"/>

       

      <property name="dropTableOnExit" value="true"/>

       

      <property name="createTableOnStart" value="true"/>

       

      </properties>

       

      </loader>

       

      </loaders>

       

      </namedCache>

       

      I am getting an exception as follows:

      java.io.IOException

       

      :

       

      org.infinispan.config.ConfigurationException

       

      org.infinispan.config.ConfigurationException

      org.infinispan.config.ConfigurationException

       

      : Couldn't find a setter named [setTimestampColumnType] which takes a single parameter, for parameter timestampColumnType on class [class org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig]

      at org.infinispan.config.InfinispanConfiguration.newInfinispanConfiguration(

       

      InfinispanConfiguration.java:225)

      at org.infinispan.config.InfinispanConfiguration.newInfinispanConfiguration(

       

      InfinispanConfiguration.java:135)

      at org.infinispan.manager.DefaultCacheManager.<init>(

       

      DefaultCacheManager.java:272)

      at org.infinispan.manager.DefaultCacheManager.<init>(

       

      DefaultCacheManager.java:253)

      at TestInfinispan.main(

       

      TestInfinispan.java:20)

      Caused by:

       

      javax.xml.bind.UnmarshalException: org.infinispan.config.ConfigurationException: Couldn't find a setter named [setTimestampColumnType] which takes a single parameter, for parameter timestampColumnType on class [class org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig]

      - with linked exception:

      [

       

      com.sun.xml.internal.bind.api.AccessorException: org.infinispan.config.ConfigurationException: Couldn't find a setter named [setTimestampColumnType] which takes a single parameter, for parameter timestampColumnType on class [class org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig]]

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(

       

      UnmarshallingContext.java:556)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(

       

      Loader.java:199)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.handleGenericException(

       

      Loader.java:189)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Scope.add(

       

      Scope.java:83)

      at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty$ReceiverImpl.receive(

       

      ArrayERProperty.java:170)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.endElement(

       

      UnmarshallingContext.java:439)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.endElement(

       

      ValidatingUnmarshaller.java:79)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.endElement(

       

      SAXConnector.java:109)

      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(

       

      AbstractSAXParser.java:601)

      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(

       

      XMLDocumentFragmentScannerImpl.java:1774)

      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(

       

      XMLDocumentFragmentScannerImpl.java:2930)

      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(

       

      XMLDocumentScannerImpl.java:648)

      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(

       

      XMLNSDocumentScannerImpl.java:140)

      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(

       

      XMLDocumentFragmentScannerImpl.java:510)

      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(

       

      XML11Configuration.java:807)

      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(

       

      XML11Configuration.java:737)

      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(

       

      XMLParser.java:107)

      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(

       

      AbstractSAXParser.java:1205)

      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(

       

      SAXParserImpl.java:522)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(

       

      UnmarshallerImpl.java:195)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(

       

      UnmarshallerImpl.java:168)

      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(

       

      AbstractUnmarshallerImpl.java:137)

      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(

       

      AbstractUnmarshallerImpl.java:105)

      at org.infinispan.config.InfinispanConfiguration.newInfinispanConfiguration(

       

      InfinispanConfiguration.java:217)

      ... 4 more

      Caused by:

       

      com.sun.xml.internal.bind.api.AccessorException: org.infinispan.config.ConfigurationException: Couldn't find a setter named [setTimestampColumnType] which takes a single parameter, for parameter timestampColumnType on class [class org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig]

      at com.sun.xml.internal.bind.v2.runtime.reflect.AdaptedLister.addToPack(

       

      AdaptedLister.java:44)

      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Scope.add(

       

      Scope.java:81)

      ... 24 more

      Caused by:

       

      org.infinispan.config.ConfigurationException: Couldn't find a setter named [setTimestampColumnType] which takes a single parameter, for parameter timestampColumnType on class [class org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStoreConfig]

      at org.infinispan.config.parsing.XmlConfigHelper.setValues(

       

      XmlConfigHelper.java:471)

      at org.infinispan.loaders.CacheLoaderConfigAdapter.unmarshal(

       

      CacheLoaderConfig.java:79)

      at org.infinispan.loaders.CacheLoaderConfigAdapter.unmarshal(

       

      CacheLoaderConfig.java:54)

      at com.sun.xml.internal.bind.v2.runtime.reflect.AdaptedLister.addToPack(

       

      AdaptedLister.java:42)

      ... 25 more