2 Replies Latest reply on Jul 4, 2014 3:43 AM by rz1911

    Missing exceptions with transactional cache and stringKeyedJdbcStore persistence

    rz1911

      Hi all,

       

      i'm a new to infinispan and try to set up a simple cache with transaction support und persistence using StringKeyedJdbcStore (infinispan 6.0.2 with MySQL 5.5).

       

      The file based configuration is

       

      ,,,

        <namedCache name="EXP">

          <clustering mode="local" />

       

          <transaction transactionMode="TRANSACTIONAL" useSynchronization="false" />

       

          <persistence passivation="false">

            <jdbc:stringKeyedJdbcStore>

              <jdbc:connectionPool connectionUrl="jdbc:mysql://localhost:3306/exp" username="xxx"

                                   password="xxx" driverClass="com.mysql.jdbc.Driver"/>

              <jdbc:stringKeyedTable prefix="test">

                <jdbc:idColumn name="ID_COLUMN" type="VARCHAR(73)"/>

                <jdbc:dataColumn name="DATA_COLUMN" type="VARBINARY(10)"/>

                <jdbc:timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT"/>

              </jdbc:stringKeyedTable>

            </jdbc:stringKeyedJdbcStore>

          </persistence>

       

        </namedCache>

      ..

       

      To test some errorhandling is tried to insert some invalid data:

      1. a non-serializable object:

                  final Cache<Object, Object> cache = instance.getCache();

                  final String key = UUID.randomUUID().toString();

                  cache.put(key, new NonSerializableItem("test 1"));

       

      2. a string value too big for the data column

                 final Cache<Object, Object> cache = instance.getCache();

                 final String key = UUID.randomUUID().toString();

                 cache.put(key, "12345678901234567890");

       

       

      My problem is, that i see the correct exceptions only logged to the console, while the exceptions are not thrown to the application API.

       

      ERROR: ISPN000136: Execution error

      org.infinispan.persistence.spi.PersistenceException: org.infinispan.commons.marshall.NotSerializableException:

       

      ERROR: ISPN008024: Error while storing string key to database; key: '8d97dec2-c8eb-4e33-9d9d-2022c954d6ef'

      com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'DATA_COLUMN' at row 1

       

       

      The values are added to the cache, while not persisted to the database.

       

      If use an configuration without transaction support

      <transaction transactionMode="NON_TRANSACTIONAL" useSynchronization="false" />

      the expected org.infinispan.commons.CacheException is thrown to the application and can be handled.

       

      My question: How do I have to change the configuration, so that these exceptions are thrown to the applications when transaction support is configured?

       

      Thanks a lot,

      Ralf