tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lia" <lia.dom...@codemart.ro>
Subject Tomcat cluster (NullPointer when replicating session)
Date Thu, 07 Aug 2008 05:04:39 GMT
Hi everybody,  

I am using 
- Tomcat 6.0.18 ( but I've also tested the same scenario with Tomcat 6.0.16
and Tomcat 6.0.14 and I got the same problem);
- in cluster ( two machines);
- on Debian x64, 4.0.
When using DeltaManager (with or without sticky sessions) the cluster works
fine, but for some special installations I would like to have
"useDirtyFlag='false'". I understand that "dirtyFlag" is used only with
SimpleTcpReplicationManager, so I changed the server.xml and context.xml, to
enable it.
When starting with a single machine, everything is fine, no error message,
but when having another node in cluster, the replication fails with the
error listed below. 

Aug 6, 2008 4:40:57 PM
org.apache.catalina.ha.session.SimpleTcpReplicationManager readSession
SEVERE: Failed to deserialize the session!
java.lang.NullPointerException
        at
java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157)
        at
java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:903)
        at
org.apache.catalina.ha.session.SimpleTcpReplicationManager.readSession(Simpl
eTcpReplicationManager.java:426)
        at
org.apache.catalina.ha.session.SimpleTcpReplicationManager.messageReceived(S
impleTcpReplicationManager.java:612)
        at
org.apache.catalina.ha.session.SimpleTcpReplicationManager.messageDataReceiv
ed(SimpleTcpReplicationManager.java:651)
        at
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(Cluste
rSessionListener.java:87)
        at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster
.java:899)
        at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster
.java:880)
        at
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.j
ava:269)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(Chan
nelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageRece
ived(TcpFailureDetector.java:110)

I've attached server.xml and context.xml files from one machine in cluster.

Analyzing the error stack trace, I've read the Tomcat source code, and I
found this, in "SimpleTcpReplicationManager":

  424          if (session==null) {
  425              session = createSession(null,false, false);
  426              sessions.remove(session.getIdInternal());
  427          }

And the signature for createSession method says:

    protected Session createSession(String sessionId, boolean notify,
boolean setId)
    {

It seems to me that createSession is called with parameter setId= false, and
then NullPointer exception is thrown at the next line, because the code
tries to search the session Id that was set to Null one line above. I
changed the line 425 into  session = createSession(null,true, true);
Now I get no NullPointerException any more, but I suppose this is not the
fair solution. Is it something wrong in my cluster configuration, can I
avoid the Null point in some other way, or SimpleTcpReplicationManager is no
longer supported?


								Thanks in
advance,
								Lia Domide


Mime
View raw message