5 Replies Latest reply on Jan 8, 2008 10:34 AM by Hany Mesha

    JDBCCacheLoader and MySQL problems

    asddsa dsasd Newbie

       

      java.lang.IllegalStateException: Failed to load node for fqn
      /viewCache/MostRecentRegularTopics/view: Unable to load to deserialize
      result: java.io.OptionalDataException
       at org.jboss.cache.loader.JDBCCacheLoader.loadNode(Unknown Source)
       at org.jboss.cache.loader.JDBCCacheLoader.get(Unknown Source)
       at org.jboss.cache.loader.AsyncCacheLoader.get(Unknown Source)
       at
      org.jboss.cache.interceptors.CacheLoaderInterceptor.loadData(Unknown Source)
       at
      org.jboss.cache.interceptors.CacheLoaderInterceptor.loadNode(Unknown Source)
       at
      org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(Unknown Source)
       at org.jboss.cache.interceptors.Interceptor.invoke(Unknown Source)
       at
      org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(Unknown Source)
       at org.jboss.cache.interceptors.Interceptor.invoke(Unknown Source)
       at
      org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(Unknown Source)
       at org.jboss.cache.interceptors.TxInterceptor.invoke(Unknown Source)
       at org.jboss.cache.interceptors.Interceptor.invoke(Unknown Source)
       at
      org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(Unknown Source)
       at org.jboss.cache.TreeCache.invokeMethod(Unknown Source)
       at org.jboss.cache.TreeCache.get(Unknown Source)
       at org.jboss.cache.TreeCache.get(Unknown Source)
       at org.jboss.cache.TreeCache.get(Unknown Source)
       at sun.reflect.GeneratedMethodAccessor344.invoke(Unknown Source)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at
      org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at
      org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at
      org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at
      org.jboss.system.server.jmx.LazyMBeanServer.invoke(LazyMBeanServer.java:291)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy363.get(Unknown Source)
       at

      I have this exception when JBC is trying to fetch objects from database that are larger than 4kB.
      I have read the following:
      http://jira.jboss.com/jira/browse/JBCACHE-320
      Hany Mesha writes that it is working for him for objects with large sizes with minor tweaking. I wonder what he mean by that :)
      Any sugestions are welcome.


        • 1. Re: JDBCCacheLoader and MySQL problems
          Damien Newbie

          do u try to change the type of field named node in table jbosscache from blob to longblob ?

          • 2. Re: JDBCCacheLoader and MySQL problems
            asddsa dsasd Newbie

            It doesn't help.
            As and addendum to first post: objects larger than 4kB get truncated to 4kB when persisting.

            • 4. Re: JDBCCacheLoader and MySQL problems
              asddsa dsasd Newbie

              JBC version is 1.4.1.SP7
              JBoss 4.2.1
              MySQL Driver 5.0.8
              Yes I have read it. My configuration:

              <cacheloader>
              
               <class>org.jboss.cache.loader.JDBCCacheLoader</class>
              
               <!-- properties to pass in to the cache loader -->
               <properties>
               cache.jdbc.datasource=java:/LocalMySqlDS
               cache.jdbc.sql-concat=concat(1,2)
               cache.jdbc.table.drop=false
               ache.jdbc.node.type=LONGBLOB
               </properties>
              
               <!-- whether the cache loader writes are asynchronous -->
               <async>true</async>
              
               <!-- only one cache loader in the chain may set fetchPersistentState to true.
               An exception is thrown if more than one cache loader sets this to true. -->
               <fetchPersistentState>false</fetchPersistentState>
              
               <!-- determines whether this cache loader ignores writes - defaults to false. -->
               <ignoreModifications>false</ignoreModifications>
              
               <!-- if set to true, purges the contents of this cache loader when the cache starts up.
               Defaults to false. -->
               <purgeOnStartup>false</purgeOnStartup>
              
               <!-- defines the cache loader as a singleton store where only the coordinator of the
               cluster will store modifications. Setting pushStateWhenCoordinator to true enables a
               newly elected coordinator to push the in-memory state to the underlying cache store.
               Both default to false. -->
               <singletonStore pushStateWhenCoordinator="false">false</singletonStore>
               </cacheloader>

              <datasources>
               <local-tx-datasource>
               <jndi-name>LocalMySqlDS</jndi-name>
               <connection-url>jdbc:mysql://host:port/database?autoReconnect=true</connection-url>
               <driver-class>com.mysql.jdbc.Driver</driver-class>
               <user-name>u</user-name>
               <password>p</password>
               <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
               <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
               <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
               <idle-timeout-minutes>1</idle-timeout-minutes>
               <max-pool-size>15</max-pool-size>
               <metadata>
               <type-mapping>mySQL</type-mapping>
               </metadata>
               </local-tx-datasource>
              </datasources>


              • 5. Re: JDBCCacheLoader and MySQL problems
                Hany Mesha Novice

                Looking at the error you're getting doesn't look like that has anything to do with the 4k limitation on the blob data type in MySQL or JBCACHE-320. In the blob case you'd get NPE upon truncation of the data stored.

                I think the problem has to do with the serialization of the objects that you're persisting. the failure doesn't happen in MySQL but rather on deserialization.

                From Java doc for the exception, Exception indicating the failure of an object read operation due to unread primitive data, or the end of data belonging to a serialized object in the stream.

                Please review your object serialization / deserialization mechanism and if you're sure that it's working correctly then please turn up JBC logging level to debug and post the log part that pertain to the database retrieve so I can examine it further.

                Cheers,

                Hany