1 Reply Latest reply on Dec 19, 2005 5:04 PM by Brian Stansberry

    TreeCacheAop and JDBC Persistance and NotSerializableExcepti

    John Lukar Newbie


      I get java.io.NotSerializableException when using the JDBC Cache loader to persist to JDBC backend.

      I was under the impression that with TreeCacheAop and aspectizing, there is no need to Serialize my cache business objects.

      could someone shed some light on this or point me to specific section in docs for this ?




      
      [16:16:31.916] [INFO ] [PrimaryCacheTest ][setUp] - SETUP
      [16:16:32.555] [INFO ] [cache.PropertyConfigurator][<init>] - Found existing property editor for org.w3c.dom.Element: org.jboss.util.propertyeditor.ElementEditor@1e152c5
      [16:16:33.105] [INFO ] [cache.PropertyConfigurator][configure] - configure(): attribute size: 20
      [16:16:33.140] [INFO ] [cache.TreeCache ][setClusterConfig] - setting cluster properties from xml to: UDP(ip_mcast=true;ip_ttl=64;loopback=false;mcast_addr=228.1.2.3;mcast_port=48866;mcast_recv_buf_size=80000;mcast_send_buf_size=150000;ucast_recv_buf_size=80000;ucast_send_buf_size=150000):PING(down_thread=false;num_initial_members=3;timeout=2000;up_thread=false):MERGE2(max_interval=20000;min_interval=10000):FD_SOCK:VERIFY_SUSPECT(down_thread=false;timeout=1500;up_thread=false):pbcast.NAKACK(down_thread=false;gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800;up_thread=false):UNICAST(down_thread=false;min_threshold=10;timeout=600,1200,2400;window_size=100):pbcast.STABLE(desired_avg_gossip=20000;down_thread=false;up_thread=false):FRAG(down_thread=false;frag_size=8192;up_thread=false):pbcast.GMS(join_retry_timeout=2000;join_timeout=5000;print_local_addr=true;shun=true):pbcast.STATE_TRANSFER(down_thread=true;up_thread=true)
      [16:16:33.299] [INFO ] [cache.TreeCache ][createPessimisticInterceptorChain] - interceptor chain is:
      class org.jboss.cache.interceptors.CallInterceptor
      class org.jboss.cache.interceptors.PessimisticLockInterceptor
      class org.jboss.cache.interceptors.CacheStoreInterceptor
      class org.jboss.cache.interceptors.CacheLoaderInterceptor
      class org.jboss.cache.interceptors.UnlockInterceptor
      [16:16:33.310] [INFO ] [cache.TreeCache ][_createService] - cache mode is local, will not create the channel
      [16:16:34.068] [INFO ] [cache.TreeCache ][cacheLoaderPreload] - preloading transient state from cache loader
      [16:16:34.127] [INFO ] [cache.TreeCache ][cacheLoaderPreload] - preloading transient state from cache loader was successful (in 57 milliseconds)
      [16:16:34.129] [INFO ] [cache.TreeCache ][startService] - Cache is started!!
      [16:16:34.237] [ERROR] [loader.JDBCCacheLoader][insertNode] - Failed to insert node: com.mycompany.performance.cache.MockOrder
      java.io.NotSerializableException: com.mycompany.performance.cache.MockOrder
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
       at java.util.HashMap.writeObject(HashMap.java:978)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
       at org.jboss.invocation.MarshalledValue.<init>(MarshalledValue.java:57)
       at org.jboss.cache.loader.JDBCCacheLoader.insertNode(JDBCCacheLoader.java:954)
       at org.jboss.cache.loader.JDBCCacheLoader.put(JDBCCacheLoader.java:338)
       at com.mycompany.performance.cache.JbossCacheAOPCacheTest.testJDBCPersistance(JbossCacheAOPCacheTest.java:449)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at junit.framework.TestCase.runTest(TestCase.java:154)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at junit.textui.TestRunner.doRun(TestRunner.java:116)
       at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
       at junit.textui.TestRunner.start(TestRunner.java:172)
       at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
       at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
       at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
      



      I use the following configuration in my config xml file:

      <attribute name="CacheLoaderClass">org.jboss.cache.loader.JDBCCacheLoader</attribute>
       <attribute name="CacheLoaderShared">false</attribute>
       <attribute name="CacheLoaderPreload">/</attribute>
       <attribute name="CacheLoaderFetchTransientState">false</attribute>
       <attribute name="CacheLoaderFetchPersistentState">true</attribute>
       <attribute name="CacheLoaderConfig">
       cache.jdbc.table.name=jbosscache2
       cache.jdbc.table.create=true
       cache.jdbc.table.drop=false
       cache.jdbc.fqn.column=fqn
       cache.jdbc.fqn.type=varchar(255)
       cache.jdbc.node.column=node
       cache.jdbc.node.type=byte
       cache.jdbc.parent.column=parent
       cache.jdbc.driver=com.informix.jdbc.IfxDriver
       cache.jdbc.url=jdbc:informix-sqli://myserver:1500/mytestdb:INFORMIXSERVER=mydbserver
       cache.jdbc.user=someuser
       cache.jdbc.password=xyz
       </attribute>