You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Alistair Forbes <fo...@googlemail.com> on 2006/05/30 01:33:27 UTC

Re: Remote cache class cast exception

It took sometime to get back to this. I am using the latest version:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: Apache Maven
Built-By: SG0894751
Package: org.apache.jcs
Build-Jdk: 1.3.1_16
Extension-Name: jcs
Specification-Title: Cache
Specification-Vendor: Apache Software Foundation
Implementation-Title: org.apache.jcs
Implementation-Vendor: Apache Software Foundation
Implementation-Version: 1.2.7.3

The message logged is identical for both the IOException and the Exception,
which makes it difficult to see what causes the exception.

90% of the time I only get the text without the stack trace, which makes me
think this is from two different exceptions. This only seems to happen when
using a remote cache - and I suspect the problem is triggered by a restart
of a client cache, but I am not 100% sure yet.

"01:25:51,735 ERROR [IndexedDiskCache] Failure getting from disk, cacheName:
testCache, key = KEY23145
java.lang.ClassCastException"

Maybe you could change the exception so that I can see which exception is
triggered.

Index: org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
===================================================================
--- org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (revision
410163)
+++ org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (working
copy)
@@ -490,7 +490,7 @@
         }
         catch ( IOException ioe )
         {
-            log.error( "Failure getting from disk, cacheName: " + cacheName
+ ", key = " + key, ioe );
+            log.error( "IO Failure getting from disk, cacheName: " +
cacheName + ", key = " + key, ioe );
             reset();
         }
         catch ( Exception e )



On 4/27/06, Aaron Smuts <as...@yahoo.com> wrote:
>
> Sorry if I missed it, but what version are you using.
>
>
> --- Alistair Forbes <fo...@googlemail.com> wrote:
>
> > Here's the full stack trace from the remote server:
> >
> > java.lang.ClassCastException:
> > org.apache.jcs.engine.CacheElementSerialized
> >         at
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > IndexedDiskCache.java:526)
> >         at
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > IndexedDiskCache.java:484)
> >         at
> > org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > AbstractDiskCache.java:298)
> >         at
> > org.apache.jcs.engine.control.CompositeCache.get(
> > CompositeCache.java:495)
> >         at
> > org.apache.jcs.engine.control.CompositeCache.get(
> > CompositeCache.java:398)
> >         at
> >
> org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > RemoteCacheServer.java:554)
> >         at
> > sun.reflect.GeneratedMethodAccessor5.invoke(Unknown
> > Source)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >         at
> > java.lang.reflect.Method.invoke(Method.java:585)
> >         at
> >
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > :294)
> >         at
> >
> sun.rmi.transport.Transport$1.run(Transport.java:153)
> >         at
> > java.security.AccessController.doPrivileged(Native
> > Method)
> >         at
> >
> sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> >         at
> > sun.rmi.transport.tcp.TCPTransport.handleMessages(
> > TCPTransport.java:460)
> >         at
> >
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
> > TCPTransport.java:701)
> >         at java.lang.Thread.run(Thread.java:595)
> >
> >
> > On 4/26/06, Alistair Forbes
> > <fo...@googlemail.com> wrote:
> > >
> > > I could try the latest version - but I have not
> > had time to check the last
> > > changes to the RMI timeouts. But it's pretty
> > recent.
> > >
> > > The remote server has access to all the
> > application classes.
> > >
> > > What is strange is that this only happens on 2 out
> > of 8 regions, and for
> > > one of these the class is really simple.
> > >
> > > For the logging...strange, but only the one line
> > is logged. I will check
> > > the log4j pattern that I have.
> > >
> > > Let me try the latest of everything and see that
> > happens.
> > >
> > >
> > >
> > > On 4/26/06, Smuts, Aaron
> > <Aa...@travelocity.com> wrote:
> > > >
> > > > What version of JCS are you using?
> > > >
> > > > The error is happening on the remote server's
> > disk cache?
> > > >
> > > > In the latest versions, the remote server is
> > passed a byte array instead
> > > > of your object.  If passed the object, then the
> > remote server would have
> > > >
> > > > to have your code.
> > > >
> > > > The full log message is only 3 lines?  The
> > commons logging api prints a
> > > > stack trace when you pass in an exception as the
> > second argument.
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Alistair Forbes
> > [mailto:forbes.al@googlemail.com]
> > > > > Sent: Wednesday, April 26, 2006 9:19 AM
> > > > > To: JCS Users List
> > > > > Subject: Remote cache class cast exception
> > > > >
> > > > > From the logs of the Remote server I get class
> > cast excepetions.
> > > > >
> > > > > I have tried serializing the objects to disk,
> > and these all seem to
> > > > work.
> > > > > Is
> > > > > there a simple way to generate the fully stack
> > trace?
> > > > >
> > > > > I log4j I thought the line below would
> > generate a full stack trace,
> > > > but
> > > > > maybe this is different in Commons logging.
> > > > >
> > > > >        catch ( IOException ioe )
> > > > >         {
> > > > >             log.error( "Failure getting from
> > disk, cacheName: " +
> > > > > cacheName
> > > > > + ", key = " + key, ioe );
> > > > >             reset();
> > > > >         }
> > > > >
> > > > >
> > > > > 15:09:24,459 ERROR [IndexedDiskCache] Failure
> > getting from disk,
> > > > > cacheName:
> > > > > textCache, key = XXXYYY
> > > > > java.lang.ClassCastException
> > > > >
> > > > >
> > > > > Any hints appreciated.
> > > > > Al
> > > >
> > > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > jcs-users-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > jcs-users-help@jakarta.apache.org
> > > >
> > > >
> > >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>

Re: Remote cache class cast exception

Posted by Aaron Smuts <as...@yahoo.com>.
I'm putting over 10 million 50k+ records a day into a
clustered remote cache server using the JDBC disk
cache backed by MySQL and it uses almost no memory. 
I'm also getting 6 million items from this cache a
day, using lateral distribution for hundreds of
thousands of puts, and using the indexed disk cache
with dozens of regions of over 20k items.  I have no
memory problems.  I run multiple tomcat instances on
the same boxes that are home to collections of similar
services.  For our service tier, I have over a dozen
machines running 6+ tomcat servers each with 1 war per
tomcat and 3-5 services per war.  My applications have
to be very memory efficient.  JCS makes it possible. 
I've detected no memory problems whatsoever with the
cache. 

Cheers,

Aaron

--- Alistair Forbes <fo...@googlemail.com> wrote:

> Hi,
> 
> The problem seems to come from restarting the client
> - (clients with local
> caches connecting to remote RMI server.)
> 
> Restarting the remote cache solves the problem.
> 
> And the good news: I tried many tests (local and
> remote caches), and I was
> unable to find any memory leak.
> 
> Cheers
> Al
> 
> On 5/30/06, Aaron Smuts <as...@yahoo.com> wrote:
> >
> > By the way, the server does not need access to the
> > classes.  The remote client serializes the objects
> > before sending them.  It sends a byte array over
> to
> > the server.  As far as the server knows, the
> payload
> > is a byte array.
> >
> > I'll fix that log message and try to replicate
> your
> > problem.
> >
> > Aaron
> >
> >
> >
> > --- Alistair Forbes <fo...@googlemail.com>
> wrote:
> >
> > > With the latest source from svn I get the
> following
> > > exception from the
> > > RemoteCacheServer: The server does have access
> to
> > > the same classpath as the
> > > application. The object is serializable as I can
> > > read and write the
> > > serialized object to disk. Any hints
> appreciated.
> > >
> > >
> > > 09:47:56,414 ERROR [IndexedDiskCache] Failure
> > > getting from disk, cacheName:
> > > ruleCache, key = 34800JR2OS12
> > > java.lang.ClassCastException:
> > > org.apache.jcs.engine.CacheElementSerialized
> > >         at
> > >
> >
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > > IndexedDiskCache.java:526)
> > >         at
> > >
> >
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > > IndexedDiskCache.java:484)
> > >         at
> > >
> org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > > AbstractDiskCache.java:298)
> > >         at
> > >
> org.apache.jcs.engine.control.CompositeCache.get(
> > > CompositeCache.java:488)
> > >         at
> > >
> org.apache.jcs.engine.control.CompositeCache.get(
> > > CompositeCache.java:391)
> > >         at
> > >
> >
>
org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > > RemoteCacheServer.java:546)
> > >         at
> > >
> sun.reflect.GeneratedMethodAccessor7.invoke(Unknown
> > > Source)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > DelegatingMethodAccessorImpl.java:25)
> > >         at
> > > java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > >
> >
>
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > > :294)
> > >         at
> > >
> >
>
sun.rmi.transport.Transport$1.run(Transport.java:153)
> > >         at
> > >
> java.security.AccessController.doPrivileged(Native
> > > Method)
> > >         at
> > >
> >
>
sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> > >         at
> > >
> sun.rmi.transport.tcp.TCPTransport.handleMessages(
> > > TCPTransport.java:460)
> > >         at
> > >
> >
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
> > > TCPTransport.java:701)
> > >         at java.lang.Thread.run(Thread.java:595)
> > >
> > >
> > >
> > > On 5/30/06, Alistair Forbes
> > > <fo...@googlemail.com> wrote:
> > > >
> > > > It took sometime to get back to this. I am
> using
> > > the latest version:
> > > >
> > > > Manifest-Version: 1.0
> > > > Ant-Version: Apache Ant 1.5.3
> > > > Created-By: Apache Maven
> > > > Built-By: SG0894751
> > > > Package: org.apache.jcs
> > > > Build-Jdk: 1.3.1_16
> > > > Extension-Name: jcs
> > > > Specification-Title: Cache
> > > > Specification-Vendor: Apache Software
> Foundation
> > > > Implementation-Title: org.apache.jcs
> > > > Implementation-Vendor: Apache Software
> Foundation
> > > > Implementation-Version: 1.2.7.3
> > > >
> > > > The message logged is identical for both the
> > > IOException and the
> > > > Exception, which makes it difficult to see
> what
> > > causes the exception.
> > > >
> > > > 90% of the time I only get the text without
> the
> > > stack trace, which makes
> > > > me think this is from two different
> exceptions.
> > > This only seems to happen
> > > > when using a remote cache - and I suspect the
> > > problem is triggered by a
> > > > restart of a client cache, but I am not 100%
> sure
> > > yet.
> > > >
> > > > "01:25:51,735 ERROR [IndexedDiskCache] Failure
> > > getting from disk,
> > > > cacheName: testCache, key = KEY23145
> > > > java.lang.ClassCastException"
> > > >
> > > > Maybe you could change the exception so that I
> can
> > > see which exception is
> > > > triggered.
> > > >
> > > > Index:
> > >
> >
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > > >
> > >
> >
>
===================================================================
> > > > ---
> > >
> >
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > > (revision
> > > > 410163)
> > > > +++
> > >
> >
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > > (working
> > > > copy)
> > > > @@ -490,7 +490,7 @@
> > > >
> > > >          }
> > > >          catch ( IOException ioe )
> > > >          {
> > > > -            log.error( "Failure getting from
> > > disk, cacheName: " +
> > > > cacheName + ", key = " + key, ioe );
> > > > +            log.error( "IO Failure getting
> from
> > > disk, cacheName: " +
> > > > cacheName + ", key = " + key, ioe );
> 
=== message truncated ===


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: Remote cache class cast exception

Posted by Alistair Forbes <fo...@googlemail.com>.
Hi,

The problem seems to come from restarting the client - (clients with local
caches connecting to remote RMI server.)

Restarting the remote cache solves the problem.

And the good news: I tried many tests (local and remote caches), and I was
unable to find any memory leak.

Cheers
Al

On 5/30/06, Aaron Smuts <as...@yahoo.com> wrote:
>
> By the way, the server does not need access to the
> classes.  The remote client serializes the objects
> before sending them.  It sends a byte array over to
> the server.  As far as the server knows, the payload
> is a byte array.
>
> I'll fix that log message and try to replicate your
> problem.
>
> Aaron
>
>
>
> --- Alistair Forbes <fo...@googlemail.com> wrote:
>
> > With the latest source from svn I get the following
> > exception from the
> > RemoteCacheServer: The server does have access to
> > the same classpath as the
> > application. The object is serializable as I can
> > read and write the
> > serialized object to disk. Any hints appreciated.
> >
> >
> > 09:47:56,414 ERROR [IndexedDiskCache] Failure
> > getting from disk, cacheName:
> > ruleCache, key = 34800JR2OS12
> > java.lang.ClassCastException:
> > org.apache.jcs.engine.CacheElementSerialized
> >         at
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > IndexedDiskCache.java:526)
> >         at
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > IndexedDiskCache.java:484)
> >         at
> > org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > AbstractDiskCache.java:298)
> >         at
> > org.apache.jcs.engine.control.CompositeCache.get(
> > CompositeCache.java:488)
> >         at
> > org.apache.jcs.engine.control.CompositeCache.get(
> > CompositeCache.java:391)
> >         at
> >
> org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > RemoteCacheServer.java:546)
> >         at
> > sun.reflect.GeneratedMethodAccessor7.invoke(Unknown
> > Source)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >         at
> > java.lang.reflect.Method.invoke(Method.java:585)
> >         at
> >
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > :294)
> >         at
> >
> sun.rmi.transport.Transport$1.run(Transport.java:153)
> >         at
> > java.security.AccessController.doPrivileged(Native
> > Method)
> >         at
> >
> sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> >         at
> > sun.rmi.transport.tcp.TCPTransport.handleMessages(
> > TCPTransport.java:460)
> >         at
> >
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
> > TCPTransport.java:701)
> >         at java.lang.Thread.run(Thread.java:595)
> >
> >
> >
> > On 5/30/06, Alistair Forbes
> > <fo...@googlemail.com> wrote:
> > >
> > > It took sometime to get back to this. I am using
> > the latest version:
> > >
> > > Manifest-Version: 1.0
> > > Ant-Version: Apache Ant 1.5.3
> > > Created-By: Apache Maven
> > > Built-By: SG0894751
> > > Package: org.apache.jcs
> > > Build-Jdk: 1.3.1_16
> > > Extension-Name: jcs
> > > Specification-Title: Cache
> > > Specification-Vendor: Apache Software Foundation
> > > Implementation-Title: org.apache.jcs
> > > Implementation-Vendor: Apache Software Foundation
> > > Implementation-Version: 1.2.7.3
> > >
> > > The message logged is identical for both the
> > IOException and the
> > > Exception, which makes it difficult to see what
> > causes the exception.
> > >
> > > 90% of the time I only get the text without the
> > stack trace, which makes
> > > me think this is from two different exceptions.
> > This only seems to happen
> > > when using a remote cache - and I suspect the
> > problem is triggered by a
> > > restart of a client cache, but I am not 100% sure
> > yet.
> > >
> > > "01:25:51,735 ERROR [IndexedDiskCache] Failure
> > getting from disk,
> > > cacheName: testCache, key = KEY23145
> > > java.lang.ClassCastException"
> > >
> > > Maybe you could change the exception so that I can
> > see which exception is
> > > triggered.
> > >
> > > Index:
> >
> org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > >
> >
> ===================================================================
> > > ---
> >
> org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > (revision
> > > 410163)
> > > +++
> >
> org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> > (working
> > > copy)
> > > @@ -490,7 +490,7 @@
> > >
> > >          }
> > >          catch ( IOException ioe )
> > >          {
> > > -            log.error( "Failure getting from
> > disk, cacheName: " +
> > > cacheName + ", key = " + key, ioe );
> > > +            log.error( "IO Failure getting from
> > disk, cacheName: " +
> > > cacheName + ", key = " + key, ioe );
> > >              reset();
> > >          }
> > >          catch ( Exception e )
> > >
> > >
> > >
> > >
> > > On 4/27/06, Aaron Smuts <as...@yahoo.com> wrote:
> > > >
> > > > Sorry if I missed it, but what version are you
> > using.
> > > >
> > > >
> > > > --- Alistair Forbes <fo...@googlemail.com>
> > wrote:
> > > >
> > > > > Here's the full stack trace from the remote
> > server:
> > > > >
> > > > > java.lang.ClassCastException:
> > > > > org.apache.jcs.engine.CacheElementSerialized
> > > > >         at
> > > > >
> > > >
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > > > > IndexedDiskCache.java :526)
> > > > >         at
> > > > >
> > > >
> >
> org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > > > > IndexedDiskCache.java:484)
> > > > >         at
> > > > >
> > org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > > > > AbstractDiskCache.java:298)
> > > > >         at
> > > > >
> > org.apache.jcs.engine.control.CompositeCache.get(
> > > > > CompositeCache.java:495)
> > > > >         at
> > > > >
> > org.apache.jcs.engine.control.CompositeCache.get(
> > > > > CompositeCache.java:398)
> > > > >         at
> > > > >
> > > >
> >
> org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > > > > RemoteCacheServer.java:554)
> > > > >         at
> > > > > sun.reflect.GeneratedMethodAccessor5.invoke
> > (Unknown
> > > > > Source)
> > > > >         at
> > > > >
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > > > DelegatingMethodAccessorImpl.java:25)
> > > > >         at
> > > > >
> > java.lang.reflect.Method.invoke(Method.java:585)
> > > > >         at
> > > > >
> > > >
> >
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > > > > :294)
> > > > >         at
> > > > >
> > > >
> >
> sun.rmi.transport.Transport$1.run(Transport.java:153)
> > > > >         at
> > > > > java.security.AccessController.doPrivileged
> > (Native
> > > > > Method)
> > > > >         at
> > > > >
> > > >
> >
> sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> >
> === message truncated ===
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>

Re: Remote cache class cast exception

Posted by Aaron Smuts <as...@yahoo.com>.
By the way, the server does not need access to the
classes.  The remote client serializes the objects
before sending them.  It sends a byte array over to
the server.  As far as the server knows, the payload
is a byte array.

I'll fix that log message and try to replicate your
problem.

Aaron



--- Alistair Forbes <fo...@googlemail.com> wrote:

> With the latest source from svn I get the following
> exception from the
> RemoteCacheServer: The server does have access to
> the same classpath as the
> application. The object is serializable as I can
> read and write the
> serialized object to disk. Any hints appreciated.
> 
> 
> 09:47:56,414 ERROR [IndexedDiskCache] Failure
> getting from disk, cacheName:
> ruleCache, key = 34800JR2OS12
> java.lang.ClassCastException:
> org.apache.jcs.engine.CacheElementSerialized
>         at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> IndexedDiskCache.java:526)
>         at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> IndexedDiskCache.java:484)
>         at
> org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> AbstractDiskCache.java:298)
>         at
> org.apache.jcs.engine.control.CompositeCache.get(
> CompositeCache.java:488)
>         at
> org.apache.jcs.engine.control.CompositeCache.get(
> CompositeCache.java:391)
>         at
>
org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> RemoteCacheServer.java:546)
>         at
> sun.reflect.GeneratedMethodAccessor7.invoke(Unknown
> Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at
> java.lang.reflect.Method.invoke(Method.java:585)
>         at
>
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> :294)
>         at
>
sun.rmi.transport.Transport$1.run(Transport.java:153)
>         at
> java.security.AccessController.doPrivileged(Native
> Method)
>         at
>
sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>         at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(
> TCPTransport.java:460)
>         at
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
> TCPTransport.java:701)
>         at java.lang.Thread.run(Thread.java:595)
> 
> 
> 
> On 5/30/06, Alistair Forbes
> <fo...@googlemail.com> wrote:
> >
> > It took sometime to get back to this. I am using
> the latest version:
> >
> > Manifest-Version: 1.0
> > Ant-Version: Apache Ant 1.5.3
> > Created-By: Apache Maven
> > Built-By: SG0894751
> > Package: org.apache.jcs
> > Build-Jdk: 1.3.1_16
> > Extension-Name: jcs
> > Specification-Title: Cache
> > Specification-Vendor: Apache Software Foundation
> > Implementation-Title: org.apache.jcs
> > Implementation-Vendor: Apache Software Foundation
> > Implementation-Version: 1.2.7.3
> >
> > The message logged is identical for both the
> IOException and the
> > Exception, which makes it difficult to see what
> causes the exception.
> >
> > 90% of the time I only get the text without the
> stack trace, which makes
> > me think this is from two different exceptions.
> This only seems to happen
> > when using a remote cache - and I suspect the
> problem is triggered by a
> > restart of a client cache, but I am not 100% sure
> yet.
> >
> > "01:25:51,735 ERROR [IndexedDiskCache] Failure
> getting from disk,
> > cacheName: testCache, key = KEY23145
> > java.lang.ClassCastException"
> >
> > Maybe you could change the exception so that I can
> see which exception is
> > triggered.
> >
> > Index:
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> >
>
===================================================================
> > ---
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> (revision
> > 410163)
> > +++
>
org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> (working
> > copy)
> > @@ -490,7 +490,7 @@
> >
> >          }
> >          catch ( IOException ioe )
> >          {
> > -            log.error( "Failure getting from
> disk, cacheName: " +
> > cacheName + ", key = " + key, ioe );
> > +            log.error( "IO Failure getting from
> disk, cacheName: " +
> > cacheName + ", key = " + key, ioe );
> >              reset();
> >          }
> >          catch ( Exception e )
> >
> >
> >
> >
> > On 4/27/06, Aaron Smuts <as...@yahoo.com> wrote:
> > >
> > > Sorry if I missed it, but what version are you
> using.
> > >
> > >
> > > --- Alistair Forbes <fo...@googlemail.com>
> wrote:
> > >
> > > > Here's the full stack trace from the remote
> server:
> > > >
> > > > java.lang.ClassCastException:
> > > > org.apache.jcs.engine.CacheElementSerialized
> > > >         at
> > > >
> > >
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > > > IndexedDiskCache.java :526)
> > > >         at
> > > >
> > >
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > > > IndexedDiskCache.java:484)
> > > >         at
> > > >
> org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > > > AbstractDiskCache.java:298)
> > > >         at
> > > >
> org.apache.jcs.engine.control.CompositeCache.get(
> > > > CompositeCache.java:495)
> > > >         at
> > > >
> org.apache.jcs.engine.control.CompositeCache.get(
> > > > CompositeCache.java:398)
> > > >         at
> > > >
> > >
>
org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > > > RemoteCacheServer.java:554)
> > > >         at
> > > > sun.reflect.GeneratedMethodAccessor5.invoke
> (Unknown
> > > > Source)
> > > >         at
> > > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > > DelegatingMethodAccessorImpl.java:25)
> > > >         at
> > > >
> java.lang.reflect.Method.invoke(Method.java:585)
> > > >         at
> > > >
> > >
>
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > > > :294)
> > > >         at
> > > >
> > >
>
sun.rmi.transport.Transport$1.run(Transport.java:153)
> > > >         at
> > > > java.security.AccessController.doPrivileged
> (Native
> > > > Method)
> > > >         at
> > > >
> > >
>
sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> 
=== message truncated ===


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: Remote cache class cast exception

Posted by Alistair Forbes <fo...@googlemail.com>.
With the latest source from svn I get the following exception from the
RemoteCacheServer: The server does have access to the same classpath as the
application. The object is serializable as I can read and write the
serialized object to disk. Any hints appreciated.


09:47:56,414 ERROR [IndexedDiskCache] Failure getting from disk, cacheName:
ruleCache, key = 34800JR2OS12
java.lang.ClassCastException: org.apache.jcs.engine.CacheElementSerialized
        at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
IndexedDiskCache.java:526)
        at org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
IndexedDiskCache.java:484)
        at org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
AbstractDiskCache.java:298)
        at org.apache.jcs.engine.control.CompositeCache.get(
CompositeCache.java:488)
        at org.apache.jcs.engine.control.CompositeCache.get(
CompositeCache.java:391)
        at org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
RemoteCacheServer.java:546)
        at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(
TCPTransport.java:460)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:595)



On 5/30/06, Alistair Forbes <fo...@googlemail.com> wrote:
>
> It took sometime to get back to this. I am using the latest version:
>
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.5.3
> Created-By: Apache Maven
> Built-By: SG0894751
> Package: org.apache.jcs
> Build-Jdk: 1.3.1_16
> Extension-Name: jcs
> Specification-Title: Cache
> Specification-Vendor: Apache Software Foundation
> Implementation-Title: org.apache.jcs
> Implementation-Vendor: Apache Software Foundation
> Implementation-Version: 1.2.7.3
>
> The message logged is identical for both the IOException and the
> Exception, which makes it difficult to see what causes the exception.
>
> 90% of the time I only get the text without the stack trace, which makes
> me think this is from two different exceptions. This only seems to happen
> when using a remote cache - and I suspect the problem is triggered by a
> restart of a client cache, but I am not 100% sure yet.
>
> "01:25:51,735 ERROR [IndexedDiskCache] Failure getting from disk,
> cacheName: testCache, key = KEY23145
> java.lang.ClassCastException"
>
> Maybe you could change the exception so that I can see which exception is
> triggered.
>
> Index: org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
> ===================================================================
> --- org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (revision
> 410163)
> +++ org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (working
> copy)
> @@ -490,7 +490,7 @@
>
>          }
>          catch ( IOException ioe )
>          {
> -            log.error( "Failure getting from disk, cacheName: " +
> cacheName + ", key = " + key, ioe );
> +            log.error( "IO Failure getting from disk, cacheName: " +
> cacheName + ", key = " + key, ioe );
>              reset();
>          }
>          catch ( Exception e )
>
>
>
>
> On 4/27/06, Aaron Smuts <as...@yahoo.com> wrote:
> >
> > Sorry if I missed it, but what version are you using.
> >
> >
> > --- Alistair Forbes <fo...@googlemail.com> wrote:
> >
> > > Here's the full stack trace from the remote server:
> > >
> > > java.lang.ClassCastException:
> > > org.apache.jcs.engine.CacheElementSerialized
> > >         at
> > >
> > org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(
> > > IndexedDiskCache.java :526)
> > >         at
> > >
> > org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(
> > > IndexedDiskCache.java:484)
> > >         at
> > > org.apache.jcs.auxiliary.disk.AbstractDiskCache.get(
> > > AbstractDiskCache.java:298)
> > >         at
> > > org.apache.jcs.engine.control.CompositeCache.get(
> > > CompositeCache.java:495)
> > >         at
> > > org.apache.jcs.engine.control.CompositeCache.get(
> > > CompositeCache.java:398)
> > >         at
> > >
> > org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.get(
> > > RemoteCacheServer.java:554)
> > >         at
> > > sun.reflect.GeneratedMethodAccessor5.invoke (Unknown
> > > Source)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > DelegatingMethodAccessorImpl.java:25)
> > >         at
> > > java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > >
> > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java
> > > :294)
> > >         at
> > >
> > sun.rmi.transport.Transport$1.run(Transport.java:153)
> > >         at
> > > java.security.AccessController.doPrivileged (Native
> > > Method)
> > >         at
> > >
> > sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> > >         at
> > > sun.rmi.transport.tcp.TCPTransport.handleMessages(
> > > TCPTransport.java:460)
> > >         at
> > >
> > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(
> > > TCPTransport.java:701)
> > >         at java.lang.Thread.run(Thread.java:595)
> > >
> > >
> > > On 4/26/06, Alistair Forbes
> > > <fo...@googlemail.com> wrote:
> > > >
> > > > I could try the latest version - but I have not
> > > had time to check the last
> > > > changes to the RMI timeouts. But it's pretty
> > > recent.
> > > >
> > > > The remote server has access to all the
> > > application classes.
> > > >
> > > > What is strange is that this only happens on 2 out
> > > of 8 regions, and for
> > > > one of these the class is really simple.
> > > >
> > > > For the logging...strange, but only the one line
> > > is logged. I will check
> > > > the log4j pattern that I have.
> > > >
> > > > Let me try the latest of everything and see that
> > > happens.
> > > >
> > > >
> > > >
> > > > On 4/26/06, Smuts, Aaron
> > > <Aa...@travelocity.com> wrote:
> > > > >
> > > > > What version of JCS are you using?
> > > > >
> > > > > The error is happening on the remote server's
> > > disk cache?
> > > > >
> > > > > In the latest versions, the remote server is
> > > passed a byte array instead
> > > > > of your object.  If passed the object, then the
> > > remote server would have
> > > > >
> > > > > to have your code.
> > > > >
> > > > > The full log message is only 3 lines?  The
> > > commons logging api prints a
> > > > > stack trace when you pass in an exception as the
> > > second argument.
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Alistair Forbes
> > > [mailto:forbes.al@googlemail.com]
> > > > > > Sent: Wednesday, April 26, 2006 9:19 AM
> > > > > > To: JCS Users List
> > > > > > Subject: Remote cache class cast exception
> > > > > >
> > > > > > From the logs of the Remote server I get class
> > > cast excepetions.
> > > > > >
> > > > > > I have tried serializing the objects to disk,
> > > and these all seem to
> > > > > work.
> > > > > > Is
> > > > > > there a simple way to generate the fully stack
> > > trace?
> > > > > >
> > > > > > I log4j I thought the line below would
> > > generate a full stack trace,
> > > > > but
> > > > > > maybe this is different in Commons logging.
> > > > > >
> > > > > >        catch ( IOException ioe )
> > > > > >         {
> > > > > >             log.error( "Failure getting from
> > > disk, cacheName: " +
> > > > > > cacheName
> > > > > > + ", key = " + key, ioe );
> > > > > >             reset();
> > > > > >         }
> > > > > >
> > > > > >
> > > > > > 15:09:24,459 ERROR [IndexedDiskCache] Failure
> > > getting from disk,
> > > > > > cacheName:
> > > > > > textCache, key = XXXYYY
> > > > > > java.lang.ClassCastException
> > > > > >
> > > > > >
> > > > > > Any hints appreciated.
> > > > > > Al
> > > > >
> > > > >
> > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > jcs-users-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > jcs-users-help@jakarta.apache.org
> > > > >
> > > > >
> > > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> >
> >
>