You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jean-Christophe Praud <jc...@praud.com> on 2006/05/18 17:02:28 UTC
ClassCastException on cluster deserialization
Hi all,
I'm setting up a Tomcat cluster on two servers, and I keep getting a
ClassCastException on a session variable (GW). The server which handles
the request works well, but the other one can't get the session data.
Its GW object seems to be instantiated,
valueBound(HttpSessionBindingEvent event) is called, the object is added
to the session, then I get the Exception.
I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
replicationMode.
My session variable com.package1.subpackage1.GW implements the
Serializable interface and contains some classes which are also
Serializable. I don't see any Exception from the writeObject or
readObject methods on any server.
My config :
<Cluster
className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="synchronous"
autoConnect="true"
keepAliveTimeout="-1"
ackTimeout="15000"/>
<Valve
className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Deployer
className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
</Cluster>
The Exception's log :
18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
setAttribute
GRAVE: Session attribute event listener threw exception
java.lang.ClassCastException: com.package1.subpackage1.GW
at
common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessionListener.java:47)
at
common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionListener.java:26)
at
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1310)
at
org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:159)
at
org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1565)
at
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManager.java:1516)
at
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaManager.java:1268)
at
org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:85)
at
org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.java:1163)
at
org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(ClusterReceiverBase.java:418)
at
org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
at
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:138)
at
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:69)
What did I miss ?
Regards,
--
Jean-Christophe Praud - http://shub-niggurath.com
Conseil & Développement Informatique http://www.praud.com
Ph'nglui mglw'nafh Cthulhu n'gah Bill R'lyeh Wgah'nagl fhtagn!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Jean-Christophe Praud <jc...@praud.com>.
Hi,
I've upgraded with your JAR, and corrected some bugs in my
SessionListener (it only logs messages to trace session updates between
nodes). It seems to work fine.
Thank you all for your help :)
JC
Filip Hanik - Dev Lists wrote:
> Hi Jean-Christophe, can you try out this JAR, it sets the context
> class loader upon attribute realization.
>
> http://people.apache.org/~fhanik/catalina-cluster.jar
>
> filip
>
> Jean-Christophe Praud wrote:
>
>> Hi all,
>>
>> I'm setting up a Tomcat cluster on two servers, and I keep getting a
>> ClassCastException on a session variable (GW). The server which
>> handles the request works well, but the other one can't get the
>> session data.
>>
>> Its GW object seems to be instantiated,
>> valueBound(HttpSessionBindingEvent event) is called, the object is
>> added to the session, then I get the Exception.
>>
>> I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
>> replicationMode.
>>
>> My session variable com.package1.subpackage1.GW implements the
>> Serializable interface and contains some classes which are also
>> Serializable. I don't see any Exception from the writeObject or
>> readObject methods on any server.
>>
>> My config :
>>
>> <Cluster
>> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>
>> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>> expireSessionsOnShutdown="false"
>> useDirtyFlag="true"
>> notifyListenersOnReplication="true">
>>
>> <Membership
>>
>> className="org.apache.catalina.cluster.mcast.McastService"
>> mcastAddr="228.0.0.4"
>> mcastPort="45564"
>> mcastFrequency="500"
>> mcastDropTime="3000"/>
>>
>> <Receiver
>>
>> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>> tcpListenAddress="auto"
>> tcpListenPort="4001"
>> tcpSelectorTimeout="100"
>> tcpThreadCount="6"/>
>>
>> <Sender
>>
>> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>> replicationMode="synchronous"
>> autoConnect="true"
>> keepAliveTimeout="-1"
>> ackTimeout="15000"/>
>>
>> <Valve
>> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>>
>> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>>
>> <Deployer
>> className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
>> tempDir="/tmp/war-temp/"
>> deployDir="/tmp/war-deploy/"
>> watchDir="/tmp/war-listen/"
>> watchEnabled="false"/>
>> <ClusterListener
>> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>> </Cluster>
>>
>>
>> The Exception's log :
>>
>> 18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
>> setAttribute
>> GRAVE: Session attribute event listener threw exception
>> java.lang.ClassCastException: com.package1.subpackage1.GW
>> at
>> common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessionListener.java:47)
>>
>> at
>> common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionListener.java:26)
>>
>> at
>> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1310)
>>
>> at
>> org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:159)
>>
>> at
>> org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1565)
>>
>> at
>> org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManager.java:1516)
>>
>> at
>> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaManager.java:1268)
>>
>> at
>> org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:85)
>>
>> at
>> org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.java:1163)
>>
>> at
>> org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(ClusterReceiverBase.java:418)
>>
>> at
>> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
>>
>> at
>> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:138)
>>
>> at
>> org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:69)
>>
>>
>>
>>
>> What did I miss ?
>>
>> Regards,
>>
>>
>
>
>
--
Jean-Christophe Praud - http://shub-niggurath.com
Conseil & Développement Informatique http://www.praud.com
Ph'nglui mglw'nafh Cthulhu n'gah Bill R'lyeh Wgah'nagl fhtagn!
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Hi Jean-Christophe, can you try out this JAR, it sets the context class
loader upon attribute realization.
http://people.apache.org/~fhanik/catalina-cluster.jar
filip
Jean-Christophe Praud wrote:
> Hi all,
>
> I'm setting up a Tomcat cluster on two servers, and I keep getting a
> ClassCastException on a session variable (GW). The server which
> handles the request works well, but the other one can't get the
> session data.
>
> Its GW object seems to be instantiated,
> valueBound(HttpSessionBindingEvent event) is called, the object is
> added to the session, then I get the Exception.
>
> I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
> replicationMode.
>
> My session variable com.package1.subpackage1.GW implements the
> Serializable interface and contains some classes which are also
> Serializable. I don't see any Exception from the writeObject or
> readObject methods on any server.
>
> My config :
>
> <Cluster
> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
> expireSessionsOnShutdown="false"
> useDirtyFlag="true"
> notifyListenersOnReplication="true">
>
> <Membership
> className="org.apache.catalina.cluster.mcast.McastService"
> mcastAddr="228.0.0.4"
> mcastPort="45564"
> mcastFrequency="500"
> mcastDropTime="3000"/>
>
> <Receiver
>
> className="org.apache.catalina.cluster.tcp.ReplicationListener"
> tcpListenAddress="auto"
> tcpListenPort="4001"
> tcpSelectorTimeout="100"
> tcpThreadCount="6"/>
>
> <Sender
>
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
> replicationMode="synchronous"
> autoConnect="true"
> keepAliveTimeout="-1"
> ackTimeout="15000"/>
>
> <Valve
> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>
> <Deployer
> className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
> tempDir="/tmp/war-temp/"
> deployDir="/tmp/war-deploy/"
> watchDir="/tmp/war-listen/"
> watchEnabled="false"/>
> <ClusterListener
> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
> </Cluster>
>
>
> The Exception's log :
>
> 18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
> setAttribute
> GRAVE: Session attribute event listener threw exception
> java.lang.ClassCastException: com.package1.subpackage1.GW
> at
> common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessionListener.java:47)
>
> at
> common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionListener.java:26)
>
> at
> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1310)
>
> at
> org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:159)
>
> at
> org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1565)
>
> at
> org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManager.java:1516)
>
> at
> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaManager.java:1268)
>
> at
> org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:85)
>
> at
> org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.java:1163)
>
> at
> org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(ClusterReceiverBase.java:418)
>
> at
> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
>
> at
> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplicationThread.java:138)
>
> at
> org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThread.java:69)
>
>
>
>
> What did I miss ?
>
> Regards,
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Filip-
I noticed I had similar exceptions caused when I switched my base JVM from
1.42 to 1.5..resolved by recompiling all classes to match expected JVM
signature of ClassLoader
I agree with your direction to understand which ClassLoader is being
invoked-
A good tutorial to understand which classes are being invoked by Tomcat is
located here
http://tomcat.apache.org/tomcat-4.1-doc/class-loader-howto.html
Martin --
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Filip Hanik - Dev Lists" <de...@hanik.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, May 21, 2006 7:58 AM
Subject: Re: ClassCastException on cluster deserialization
> what does line ClusterAppSessionListener.java:47 do?
> can you send us a test case, could be possible that the context
> classloader isn't set, hence the loading is failing.
>
> java.lang.ClassCastException: com.package1.subpackage1.GW
> at
> common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessionListener.java:47)
> at
> common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionListener.java:26)
> at
> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1310)
>
> Filip
>
> Jean-Christophe Praud wrote:
>> No. This a specific class for my webapp. It is located in the webapp's
>> /classes tree, and is instantiated only once per session.
>>
>> Tim Lucia wrote:
>>
>>> Are there multiple copies of this class in scope (loaded by different
>>> class
>>> loaders)? I know if you have some Oracle classes in WEB-INF/lib AND in
>>> common/lib, you can get a CCE casting from a oracle.X to an oracle.X as
>>> they
>>> come from different class loaders.
>>>
>>> Tim
>>>
>>>
>>> -----Original Message-----
>>> From: Jean-Christophe Praud [mailto:jc@praud.com] Sent: Thursday, May
>>> 18, 2006 11:02 AM
>>> To: users@tomcat.apache.org
>>> Subject: ClassCastException on cluster deserialization
>>>
>>> Hi all,
>>>
>>> I'm setting up a Tomcat cluster on two servers, and I keep getting a
>>> ClassCastException on a session variable (GW). The server which handles
>>> the request works well, but the other one can't get the session data.
>>>
>>> Its GW object seems to be instantiated,
>>> valueBound(HttpSessionBindingEvent event) is called, the object is added
>>> to the session, then I get the Exception.
>>>
>>> I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
>>> replicationMode.
>>>
>>> My session variable com.package1.subpackage1.GW implements the
>>> Serializable interface and contains some classes which are also
>>> Serializable. I don't see any Exception from the writeObject or
>>> readObject methods on any server.
>>>
>>> My config :
>>>
>>> <Cluster
>>> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>>
>>> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>>> expireSessionsOnShutdown="false"
>>> useDirtyFlag="true"
>>> notifyListenersOnReplication="true">
>>>
>>> <Membership
>>>
>>> className="org.apache.catalina.cluster.mcast.McastService"
>>> mcastAddr="228.0.0.4"
>>> mcastPort="45564"
>>> mcastFrequency="500"
>>> mcastDropTime="3000"/>
>>>
>>> <Receiver
>>>
>>> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>>> tcpListenAddress="auto"
>>> tcpListenPort="4001"
>>> tcpSelectorTimeout="100"
>>> tcpThreadCount="6"/>
>>>
>>> <Sender
>>>
>>> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>>> replicationMode="synchronous"
>>> autoConnect="true"
>>> keepAliveTimeout="-1"
>>> ackTimeout="15000"/>
>>>
>>> <Valve
>>> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>>>
>>> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>>> <Deployer
>>> className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
>>> tempDir="/tmp/war-temp/"
>>> deployDir="/tmp/war-deploy/"
>>> watchDir="/tmp/war-listen/"
>>> watchEnabled="false"/>
>>> <ClusterListener
>>> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>>> </Cluster>
>>>
>>>
>>> The Exception's log :
>>>
>>> 18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
>>> setAttribute
>>> GRAVE: Session attribute event listener threw exception
>>> java.lang.ClassCastException: com.package1.subpackage1.GW
>>> at
>>> common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessio
>>> nListener.java:47)
>>> at
>>> common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionL
>>> istener.java:26)
>>> at
>>> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
>>> ava:1310)
>>> at
>>> org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:1
>>> 59)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaMa
>>> nager.java:1565)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
>>> r.java:1516)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
>>> nager.java:1268)
>>> at
>>> org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(C
>>> lusterSessionListener.java:85)
>>> at
>>> org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.ja
>>> va:1163)
>>> at
>>> org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(Clus
>>> terReceiverBase.java:418)
>>> at
>>> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
>>> at
>>> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
>>> tionThread.java:138)
>>> at
>>> org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
>>> d.java:69)
>>>
>>>
>>>
>>> What did I miss ?
>>>
>>> Regards,
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Peter Rossbach <pr...@objektpark.de>.
Hmm, you are right...
I see that we only set context classloader at
DeltaManager.loadDeltaRequest at deserialize information
Loader loader = null;
ClassLoader classLoader = null;
//fix to be able to run the DeltaManager
//stand alone without a container.
//use the Threads context class loader
if (container != null)
loader = container.getLoader();
if (loader != null)
classLoader = loader.getClassLoader();
else
classLoader = Thread.currentThread
().getContextClassLoader();
//end fix
fis = new ByteArrayInputStream(data);
ois = new ReplicationStream(fis, classLoader);
but we not set thread context class loader for listeners :-(
see. DeltaManager.handle_SESSION_XXX
Peter
Am 21.05.2006 um 13:58 schrieb Filip Hanik - Dev Lists:
> what does line ClusterAppSessionListener.java:47 do?
> can you send us a test case, could be possible that the context
> classloader isn't set, hence the loading is failing.
>
> java.lang.ClassCastException: com.package1.subpackage1.GW
> at common.listeners.ClusterAppSessionListener.printSessionInfo
> (ClusterAppSessionListener.java:47)
> at common.listeners.ClusterAppSessionListener.attributeAdded
> (ClusterAppSessionListener.java:26)
> at
> org.apache.catalina.cluster.session.DeltaSession.setAttribute
> (DeltaSession.java:1310)
>
> Filip
>
> Jean-Christophe Praud wrote:
>> No. This a specific class for my webapp. It is located in the
>> webapp's /classes tree, and is instantiated only once per session.
>>
>> Tim Lucia wrote:
>>
>>> Are there multiple copies of this class in scope (loaded by
>>> different class
>>> loaders)? I know if you have some Oracle classes in WEB-INF/lib
>>> AND in
>>> common/lib, you can get a CCE casting from a oracle.X to an
>>> oracle.X as they
>>> come from different class loaders.
>>>
>>> Tim
>>>
>>>
>>> -----Original Message-----
>>> From: Jean-Christophe Praud [mailto:jc@praud.com] Sent: Thursday,
>>> May 18, 2006 11:02 AM
>>> To: users@tomcat.apache.org
>>> Subject: ClassCastException on cluster deserialization
>>>
>>> Hi all,
>>>
>>> I'm setting up a Tomcat cluster on two servers, and I keep
>>> getting a ClassCastException on a session variable (GW). The
>>> server which handles the request works well, but the other one
>>> can't get the session data.
>>>
>>> Its GW object seems to be instantiated, valueBound
>>> (HttpSessionBindingEvent event) is called, the object is added to
>>> the session, then I get the Exception.
>>>
>>> I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
>>> replicationMode.
>>>
>>> My session variable com.package1.subpackage1.GW implements the
>>> Serializable interface and contains some classes which are also
>>> Serializable. I don't see any Exception from the writeObject or
>>> readObject methods on any server.
>>>
>>> My config :
>>>
>>> <Cluster
>>> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>>
>>> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>>> expireSessionsOnShutdown="false"
>>> useDirtyFlag="true"
>>> notifyListenersOnReplication="true">
>>>
>>> <Membership
>>>
>>> className="org.apache.catalina.cluster.mcast.McastService"
>>> mcastAddr="228.0.0.4"
>>> mcastPort="45564"
>>> mcastFrequency="500"
>>> mcastDropTime="3000"/>
>>>
>>> <Receiver
>>>
>>> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>>> tcpListenAddress="auto"
>>> tcpListenPort="4001"
>>> tcpSelectorTimeout="100"
>>> tcpThreadCount="6"/>
>>>
>>> <Sender
>>>
>>> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>>> replicationMode="synchronous"
>>> autoConnect="true"
>>> keepAliveTimeout="-1"
>>> ackTimeout="15000"/>
>>>
>>> <Valve
>>> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>>> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*
>>> \.htm;.*\.html;.*\.css;.*\.txt;"/>
>>> <Deployer
>>> className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
>>> tempDir="/tmp/war-temp/"
>>> deployDir="/tmp/war-deploy/"
>>> watchDir="/tmp/war-listen/"
>>> watchEnabled="false"/>
>>> <ClusterListener
>>> className="org.apache.catalina.cluster.session.ClusterSessionListene
>>> r"/>
>>> </Cluster>
>>>
>>>
>>> The Exception's log :
>>>
>>> 18 mai 2006 16:48:28
>>> org.apache.catalina.cluster.session.DeltaSession setAttribute
>>> GRAVE: Session attribute event listener threw exception
>>> java.lang.ClassCastException: com.package1.subpackage1.GW
>>> at
>>> common.listeners.ClusterAppSessionListener.printSessionInfo
>>> (ClusterAppSessio
>>> nListener.java:47)
>>> at
>>> common.listeners.ClusterAppSessionListener.attributeAdded
>>> (ClusterAppSessionL
>>> istener.java:26)
>>> at
>>> org.apache.catalina.cluster.session.DeltaSession.setAttribute
>>> (DeltaSession.j
>>> ava:1310)
>>> at org.apache.catalina.cluster.session.DeltaRequest.execute
>>> (DeltaRequest.java:1
>>> 59)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA
>>> (DeltaMa
>>> nager.java:1565)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.messageReceived
>>> (DeltaManage
>>> r.java:1516)
>>> at
>>> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived
>>> (DeltaMa
>>> nager.java:1268)
>>> at
>>> org.apache.catalina.cluster.session.ClusterSessionListener.messageRe
>>> ceived(C
>>> lusterSessionListener.java:85)
>>> at org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive
>>> (SimpleTcpCluster.ja
>>> va:1163)
>>> at
>>> org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataRecei
>>> ved(Clus
>>> terReceiverBase.java:418)
>>> at org.apache.catalina.cluster.io.ObjectReader.execute
>>> (ObjectReader.java:107)
>>> at
>>> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel
>>> (TcpReplica
>>> tionThread.java:138)
>>> at org.apache.catalina.cluster.tcp.TcpReplicationThread.run
>>> (TcpReplicationThrea
>>> d.java:69)
>>>
>>>
>>>
>>> What did I miss ?
>>>
>>> Regards,
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
what does line ClusterAppSessionListener.java:47 do?
can you send us a test case, could be possible that the context
classloader isn't set, hence the loading is failing.
java.lang.ClassCastException: com.package1.subpackage1.GW
at
common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessionListener.java:47)
at
common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionListener.java:26)
at
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.java:1310)
Filip
Jean-Christophe Praud wrote:
> No. This a specific class for my webapp. It is located in the webapp's
> /classes tree, and is instantiated only once per session.
>
> Tim Lucia wrote:
>
>> Are there multiple copies of this class in scope (loaded by different
>> class
>> loaders)? I know if you have some Oracle classes in WEB-INF/lib AND in
>> common/lib, you can get a CCE casting from a oracle.X to an oracle.X
>> as they
>> come from different class loaders.
>>
>> Tim
>>
>>
>> -----Original Message-----
>> From: Jean-Christophe Praud [mailto:jc@praud.com] Sent: Thursday, May
>> 18, 2006 11:02 AM
>> To: users@tomcat.apache.org
>> Subject: ClassCastException on cluster deserialization
>>
>> Hi all,
>>
>> I'm setting up a Tomcat cluster on two servers, and I keep getting a
>> ClassCastException on a session variable (GW). The server which
>> handles the request works well, but the other one can't get the
>> session data.
>>
>> Its GW object seems to be instantiated,
>> valueBound(HttpSessionBindingEvent event) is called, the object is
>> added to the session, then I get the Exception.
>>
>> I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
>> replicationMode.
>>
>> My session variable com.package1.subpackage1.GW implements the
>> Serializable interface and contains some classes which are also
>> Serializable. I don't see any Exception from the writeObject or
>> readObject methods on any server.
>>
>> My config :
>>
>> <Cluster
>> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>
>> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>> expireSessionsOnShutdown="false"
>> useDirtyFlag="true"
>> notifyListenersOnReplication="true">
>>
>> <Membership
>>
>> className="org.apache.catalina.cluster.mcast.McastService"
>> mcastAddr="228.0.0.4"
>> mcastPort="45564"
>> mcastFrequency="500"
>> mcastDropTime="3000"/>
>>
>> <Receiver
>>
>> className="org.apache.catalina.cluster.tcp.ReplicationListener"
>> tcpListenAddress="auto"
>> tcpListenPort="4001"
>> tcpSelectorTimeout="100"
>> tcpThreadCount="6"/>
>>
>> <Sender
>>
>> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>> replicationMode="synchronous"
>> autoConnect="true"
>> keepAliveTimeout="-1"
>> ackTimeout="15000"/>
>>
>> <Valve
>> className="org.apache.catalina.cluster.tcp.ReplicationValve"
>>
>> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>>
>> <Deployer
>> className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
>> tempDir="/tmp/war-temp/"
>> deployDir="/tmp/war-deploy/"
>> watchDir="/tmp/war-listen/"
>> watchEnabled="false"/>
>> <ClusterListener
>> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>> </Cluster>
>>
>>
>> The Exception's log :
>>
>> 18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
>> setAttribute
>> GRAVE: Session attribute event listener threw exception
>> java.lang.ClassCastException: com.package1.subpackage1.GW
>> at
>> common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessio
>>
>> nListener.java:47)
>> at
>> common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionL
>>
>> istener.java:26)
>> at
>> org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
>>
>> ava:1310)
>> at
>> org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:1
>>
>> 59)
>> at
>> org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaMa
>>
>> nager.java:1565)
>> at
>> org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
>>
>> r.java:1516)
>> at
>> org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
>>
>> nager.java:1268)
>> at
>> org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(C
>>
>> lusterSessionListener.java:85)
>> at
>> org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.ja
>>
>> va:1163)
>> at
>> org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(Clus
>>
>> terReceiverBase.java:418)
>> at
>> org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
>>
>> at
>> org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
>>
>> tionThread.java:138)
>> at
>> org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
>>
>> d.java:69)
>>
>>
>>
>> What did I miss ?
>>
>> Regards,
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassCastException on cluster deserialization
Posted by Jean-Christophe Praud <jc...@praud.com>.
No. This a specific class for my webapp. It is located in the webapp's
/classes tree, and is instantiated only once per session.
Tim Lucia wrote:
>Are there multiple copies of this class in scope (loaded by different class
>loaders)? I know if you have some Oracle classes in WEB-INF/lib AND in
>common/lib, you can get a CCE casting from a oracle.X to an oracle.X as they
>come from different class loaders.
>
>Tim
>
>
>-----Original Message-----
>From: Jean-Christophe Praud [mailto:jc@praud.com]
>Sent: Thursday, May 18, 2006 11:02 AM
>To: users@tomcat.apache.org
>Subject: ClassCastException on cluster deserialization
>
>Hi all,
>
>I'm setting up a Tomcat cluster on two servers, and I keep getting a
>ClassCastException on a session variable (GW). The server which handles
>the request works well, but the other one can't get the session data.
>
>Its GW object seems to be instantiated,
>valueBound(HttpSessionBindingEvent event) is called, the object is added
>to the session, then I get the Exception.
>
>I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
>replicationMode.
>
>My session variable com.package1.subpackage1.GW implements the
>Serializable interface and contains some classes which are also
>Serializable. I don't see any Exception from the writeObject or
>readObject methods on any server.
>
>My config :
>
> <Cluster
>className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>
>managerClassName="org.apache.catalina.cluster.session.DeltaManager"
> expireSessionsOnShutdown="false"
> useDirtyFlag="true"
> notifyListenersOnReplication="true">
>
> <Membership
> className="org.apache.catalina.cluster.mcast.McastService"
> mcastAddr="228.0.0.4"
> mcastPort="45564"
> mcastFrequency="500"
> mcastDropTime="3000"/>
>
> <Receiver
>
>className="org.apache.catalina.cluster.tcp.ReplicationListener"
> tcpListenAddress="auto"
> tcpListenPort="4001"
> tcpSelectorTimeout="100"
> tcpThreadCount="6"/>
>
> <Sender
>
>className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
> replicationMode="synchronous"
> autoConnect="true"
> keepAliveTimeout="-1"
> ackTimeout="15000"/>
>
> <Valve
>className="org.apache.catalina.cluster.tcp.ReplicationValve"
>
>filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>
> <Deployer
>className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
> tempDir="/tmp/war-temp/"
> deployDir="/tmp/war-deploy/"
> watchDir="/tmp/war-listen/"
> watchEnabled="false"/>
>
> <ClusterListener
>className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
> </Cluster>
>
>
>The Exception's log :
>
>18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
>setAttribute
>GRAVE: Session attribute event listener threw exception
>java.lang.ClassCastException: com.package1.subpackage1.GW
> at
>common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessio
>nListener.java:47)
> at
>common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionL
>istener.java:26)
> at
>org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
>ava:1310)
> at
>org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:1
>59)
> at
>org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaMa
>nager.java:1565)
> at
>org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
>r.java:1516)
> at
>org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
>nager.java:1268)
> at
>org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(C
>lusterSessionListener.java:85)
> at
>org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.ja
>va:1163)
> at
>org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(Clus
>terReceiverBase.java:418)
> at
>org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
> at
>org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
>tionThread.java:138)
> at
>org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
>d.java:69)
>
>
>
>What did I miss ?
>
>Regards,
>
>
>
>
--
Jean-Christophe Praud - http://shub-niggurath.com
Conseil & Développement Informatique http://www.praud.com
Ph'nglui mglw'nafh Cthulhu n'gah Bill R'lyeh Wgah'nagl fhtagn!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: ClassCastException on cluster deserialization
Posted by Tim Lucia <ti...@yahoo.com>.
Are there multiple copies of this class in scope (loaded by different class
loaders)? I know if you have some Oracle classes in WEB-INF/lib AND in
common/lib, you can get a CCE casting from a oracle.X to an oracle.X as they
come from different class loaders.
Tim
-----Original Message-----
From: Jean-Christophe Praud [mailto:jc@praud.com]
Sent: Thursday, May 18, 2006 11:02 AM
To: users@tomcat.apache.org
Subject: ClassCastException on cluster deserialization
Hi all,
I'm setting up a Tomcat cluster on two servers, and I keep getting a
ClassCastException on a session variable (GW). The server which handles
the request works well, but the other one can't get the session data.
Its GW object seems to be instantiated,
valueBound(HttpSessionBindingEvent event) is called, the object is added
to the session, then I get the Exception.
I tried with Tomcat 5.5.16 and 5.5.17, with several <Sender>
replicationMode.
My session variable com.package1.subpackage1.GW implements the
Serializable interface and contains some classes which are also
Serializable. I don't see any Exception from the writeObject or
readObject methods on any server.
My config :
<Cluster
className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="synchronous"
autoConnect="true"
keepAliveTimeout="-1"
ackTimeout="15000"/>
<Valve
className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Deployer
className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
</Cluster>
The Exception's log :
18 mai 2006 16:48:28 org.apache.catalina.cluster.session.DeltaSession
setAttribute
GRAVE: Session attribute event listener threw exception
java.lang.ClassCastException: com.package1.subpackage1.GW
at
common.listeners.ClusterAppSessionListener.printSessionInfo(ClusterAppSessio
nListener.java:47)
at
common.listeners.ClusterAppSessionListener.attributeAdded(ClusterAppSessionL
istener.java:26)
at
org.apache.catalina.cluster.session.DeltaSession.setAttribute(DeltaSession.j
ava:1310)
at
org.apache.catalina.cluster.session.DeltaRequest.execute(DeltaRequest.java:1
59)
at
org.apache.catalina.cluster.session.DeltaManager.handleSESSION_DELTA(DeltaMa
nager.java:1565)
at
org.apache.catalina.cluster.session.DeltaManager.messageReceived(DeltaManage
r.java:1516)
at
org.apache.catalina.cluster.session.DeltaManager.messageDataReceived(DeltaMa
nager.java:1268)
at
org.apache.catalina.cluster.session.ClusterSessionListener.messageReceived(C
lusterSessionListener.java:85)
at
org.apache.catalina.cluster.tcp.SimpleTcpCluster.receive(SimpleTcpCluster.ja
va:1163)
at
org.apache.catalina.cluster.tcp.ClusterReceiverBase.messageDataReceived(Clus
terReceiverBase.java:418)
at
org.apache.catalina.cluster.io.ObjectReader.execute(ObjectReader.java:107)
at
org.apache.catalina.cluster.tcp.TcpReplicationThread.drainChannel(TcpReplica
tionThread.java:138)
at
org.apache.catalina.cluster.tcp.TcpReplicationThread.run(TcpReplicationThrea
d.java:69)
What did I miss ?
Regards,
--
Jean-Christophe Praud - http://shub-niggurath.com
Conseil & Développement Informatique http://www.praud.com
Ph'nglui mglw'nafh Cthulhu n'gah Bill R'lyeh Wgah'nagl fhtagn!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org