4 Replies Latest reply on Aug 4, 2008 12:56 PM by Manik Surtani

    CacheException while getting object from CacheLoader

    u c Newbie

      I am writing an object to the cache that I get as a response from a soap call (using apache axis). The object implements Serializable and are auto generated using the wsdl. While reading the object (using get ) back from the cacheloader (jbdc) I get CacheException. As long as the object is in memory there is no problem getting the object but ones it is evicted from the memory and I try to read it back the exception shows

      2008-07-24 18:38:00,589 [WARN ] IdentityPro RefID: '30d0d0e3-6fd1-40a3-af07-b811a74634ad' cns.reports.identity.IdentityReport.reportProcess(IdentityReport.java:150) - java.io.StreamCorruptedException (AIBR)
      org.jboss.cache.CacheException: java.io.StreamCorruptedException
      at org.jboss.cache.invocation.AbstractInvocationDelegate.invoke(AbstractInvocationDelegate.java:135)
      at org.jboss.cache.invocation.AbstractInvocationDelegate.invoke(AbstractInvocationDelegate.java:64)
      at org.jboss.cache.invocation.CacheInvocationDelegate.get(CacheInvocationDelegate.java:387)
      at org.jboss.cache.invocation.CacheInvocationDelegate.get(CacheInvocationDelegate.java:392)
      at cns.reports.identity.data.test.soap.WsDataServiceSoapStub.bpsReport(WsAccurintServiceSoapStub.java:10020)
      at cns.reports.identity.data.test.BpsReport.call(BpsReport.java:87)
      at cns.reports.identity.IdentityReport.reportProcess(IdentityReport.java:143)
      at cns.reports.identity.IdentityReport.doReport(IdentityReport.java:219)
      at cns.reports.features.callable.ReportCall$ReportCallable.call(ReportCall.java:154)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.io.StreamCorruptedException
      at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java:1378)
      at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:634)
      at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:789)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1534)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
      at org.jboss.cache.marshall.MarshalledValue.deserialize(MarshalledValue.java:80)
      at org.jboss.cache.marshall.MarshalledValue.get(MarshalledValue.java:147)
      at org.jboss.cache.interceptors.MarshalledValueInterceptor.invoke(MarshalledValueInterceptor.java:79)
      at org.jboss.cache.interceptors.Interceptor.nextInterceptor(Interceptor.java:111)
      at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:456)
      at org.jboss.cache.interceptors.TxInterceptor.handleGetKeyValueMethod(TxInterceptor.java:250)
      at org.jboss.cache.interceptors.MethodDispacherInterceptor.invoke(MethodDispacherInterceptor.java:84)
      at org.jboss.cache.interceptors.Interceptor.nextInterceptor(Interceptor.java:111)
      at org.jboss.cache.interceptors.CacheMgmtInterceptor.handleGetKeyValueMethod(CacheMgmtInterceptor.java:81)
      at org.jboss.cache.interceptors.MethodDispacherInterceptor.invoke(MethodDispacherInterceptor.java:84)
      at org.jboss.cache.interceptors.Interceptor.nextInterceptor(Interceptor.java:111)
      at org.jboss.cache.interceptors.InvocationContextInterceptor.invoke(InvocationContextInterceptor.java:73)
      at org.jboss.cache.invocation.AbstractInvocationDelegate.invoke(AbstractInvocationDelegate.java:123)
      ... 13 more

      My Cache config is as follows (i did not know if there is xml2bbcode so I changed the < to [). I am using jbosscache-core-2.1.1.GA.

      [?xml version="1.0" encoding="UTF-8"?]

      [!-- ===================================================================== --]
      [!-- --]
      [!-- Sample JBoss Cache Service Configuration --]
      [!-- --]
      [!-- ===================================================================== --]

      [server]

      [!-- ==================================================================== --]
      [!-- Defines JBoss Cache configuration --]
      [!-- ==================================================================== --]


      [!--
      [mbean code="org.jboss.cache.TreeCache"
      name="jboss.cache:service=TreeCache"]
      --]
      [mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
      name="jboss.ujjwalcache:service=Cache"]


      [attribute name="IsolationLevel"]REPEATABLE_READ[/attribute]

      [!-- Lock parent before doing node additions/removes --]
      [attribute name="LockParentForChildInsertRemove"]true[/attribute]

      [!-- Valid modes are LOCAL (default)
      REPL_ASYNC
      REPL_SYNC
      INVALIDATION_ASYNC
      INVALIDATION_SYNC --]
      [attribute name="CacheMode"]LOCAL[/attribute]

      [!-- Name of cluster. Needs to be the same for all JBoss Cache nodes in a
      cluster in order to find each other.
      --]
      [attribute name="ClusterName"]JBossCache-Cluster[/attribute]

      [attribute name="ClusterConfig"]
      [config]
      [!-- UDP: if you have a multihomed machine, set the bind_addr
      attribute to the appropriate NIC IP address --]
      [!-- UDP: On Windows machines, because of the media sense feature
      being broken with multicast (even after disabling media sense)
      set the loopback attribute to true --]
      [UDP mcast_addr="228.1.2.3" mcast_port="48866"
      ip_ttl="64" ip_mcast="true"
      mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
      ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
      loopback="false"/]
      [PING timeout="2000" num_initial_members="3"/]
      [MERGE2 min_interval="10000" max_interval="20000"/]
      [FD shun="true"/]
      [FD_SOCK/]
      [VERIFY_SUSPECT timeout="1500"/]
      [pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" /]
      [UNICAST timeout="600,1200,2400,4800" /]
      [pbcast.STABLE desired_avg_gossip="400000"/]
      [FC max_credits="2000000" min_threshold="0.10"/]
      [FRAG2 frag_size="8192"/]
      [pbcast.GMS join_timeout="5000" shun="true" print_local_addr="true"/]
      [pbcast.STATE_TRANSFER/]
      [/config]
      [/attribute]

      [!--
      The max amount of time (in milliseconds) we wait until the
      initial state (ie. the contents of the cache) are retrieved from
      existing members in a clustered environment
      --]
      [attribute name="StateRetrievalTimeout"]20000[/attribute]

      [!--
      Number of milliseconds to wait until all responses for a
      synchronous call have been received.
      --]
      [attribute name="SyncReplTimeout"]20000[/attribute]

      [!-- Max number of milliseconds to wait for a lock acquisition --]
      [attribute name="LockAcquisitionTimeout"]15000[/attribute]

      [!-- Shutdown hook behavior. Valid choices are: DEFAULT, REGISTER and DONT_REGISTER.
      If this element is omitted, DEFAULT is used. --]
      [attribute name="ShutdownHookBehavior"]DEFAULT[/attribute]

      [!-- Enables or disables lazy unmarshalling. If omitted, the default is that lazy unmarshalling is enabled. --]
      [attribute name="UseLazyDeserialization"]true[/attribute]

      [!-- Specific eviction policy configurations. This is LRU --]
      [attribute name="EvictionPolicyConfig"]
      [config]
      [attribute name="wakeUpIntervalSeconds"]60[/attribute]
      [!-- This defaults to 200000 if not specified --]
      [attribute name="eventQueueSize"]200000[/attribute]

      [attribute name="policyClass"]org.jboss.cache.eviction.LRUPolicy[/attribute]


      [!-- Cache wide default --]
      [region name="/mycache"]
      [attribute name="maxNodes"]5[/attribute]
      [attribute name="maxAgeSeconds"]60[/attribute]
      [attribute name="timeToLiveSeconds"]60[/attribute]
      [/region]

      [/config]
      [/attribute]

      [!-- Cache Passivation for Tree Cache
      On pasivation, The objects are written to the backend store on eviction if CacheLoaderPassivation
      is true, otheriwse the objects are persisted.
      On activation, the objects are restored in the memory cache and removed from the cache loader
      if CacheLoaderPassivation is true, otherwise the objects are only loaded from the cache loader --]
      [attribute name="CacheLoaderConfig"]
      [config]
      [!-- if passivation is true, only the first cache loader is used; the rest are ignored --]
      [passivation]false[/passivation]
      [preload]/mycache[/preload]
      [shared]true[/shared]

      [!-- we can now have multiple cache loaders, which get chained --]
      [cacheloader]
      [class]org.jboss.cache.loader.JDBCCacheLoader[/class]
      [!-- same as the old CacheLoaderConfig attribute --]
      [properties]
      cache.jdbc.table.name=jbosscachenew
      cache.jdbc.table.create=true
      cache.jdbc.table.drop=false
      cache.jdbc.table.primarykey=jbosscachenew_pk
      cache.jdbc.fqn.column=fqn
      cache.jdbc.fqn.type=varchar(255)
      cache.jdbc.node.column=node
      cache.jdbc.node.type=blob
      cache.jdbc.parent.column=parent
      cache.jdbc.driver=com.mysql.jdbc.Driver
      cache.jdbc.url=jdbc:mysql://testdb3:3315/GIS_DEV
      cache.jdbc.user=gis
      cache.jdbc.password=tester
      cache.jdbc.sql-concat=concat(1,2)
      [/properties]
      [!-- whether the cache loader writes are asynchronous --]
      [async]false[/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]true[/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]
      [/cacheloader]
      [/config]
      [/attribute]

      [/mbean]
      [/server]