title: SEVERE: Manager [localhost#/]: Unable to receive message through TCP channel
body: <p>I am currently in the process of setting up a tomcat 6 clustered environment, liferay 6.0.6.
  4 nodes with session replication. No sticky session.</p>
  
  <p>So following the guide supplied on this site i did the following :</p>
  
  <p>webapps/conf/context.xml added : 
  webapps/ROOT/WEB-INF/web.xml added :  to the top of the file, after the first bracket.
  I also added distributable to all my custom portlets web.xml.
  In setenv.sh : -Djava.net.preferIPv6Addresses=false -Djava.net.preferIPv4Stack=true</p>
  
  <p>In webapps/conf/server.xml</p>
  
  <pre><code>&lt;Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcatA" /&gt;
  </code></pre>
  
  <p>tomcatA/B/C/D accross the nodes.</p>
  
  <pre><code>&lt;Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
      channelSendOptions="8"&gt;
      &lt;Manager className="org.apache.catalina.ha.session.DeltaManager"
          expireSessionsOnShutdown="false" notifyListenersOnReplication="true" /&gt;
      &lt;Channel className="org.apache.catalina.tribes.group.GroupChannel"&gt;
          &lt;Membership className="org.apache.catalina.tribes.membership.McastService"
              address="228.0.0.10" port="45564" frequency="500" dropTime="3000" /&gt;
          &lt;Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
              address="auto" port="4000" autoBind="100" selectorTimeout="5000"
              maxThreads="6" /&gt;
          &lt;Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"&gt;
              &lt;Transport
                  className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" timeout="30000" /&gt;
          &lt;/Sender&gt;
          &lt;Interceptor
              className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" /&gt;
              &lt;Interceptor
              className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor" /&gt;
      &lt;/Channel&gt;
      &lt;Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
          filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.css;.*\.txt;" /&gt;
      &lt;ClusterListener
          className="org.apache.catalina.ha.session.ClusterSessionListener" /&gt;
  &lt;/Cluster&gt;
  </code></pre>
  
  <p>At startup each node detects each other and it seems to work. However , when someone tries to modify the webcontent we get an error:</p>
  
  <pre><code>SEVERE: Manager [localhost#/]: Unable to receive message through TCP channel
  java.lang.IllegalStateException: setAttribute: Session already invalidated
      at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1326)
      at org.apache.catalina.ha.session.DeltaSession.setAttribute(DeltaSession.java:594)
      at org.apache.catalina.ha.session.DeltaRequest.execute(DeltaRequest.java:164)
      at org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1487)
      at org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1437)
      at org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1171)
      at org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
      at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
      at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
      at org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
      at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
      at org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
      at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
      at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
          at org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
      at org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
      at org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
      at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>my liferay-ext.properties :</p>
  
  <pre><code>cluster.link.autodetect.address=www.google.com:80
  lucene.replicate.write=true
  cluster.link.enabled=true
  
  net.sf.ehcache.configurationResourceName=/cache/hibernate-clustered.xml
  ehcache.multi.vm.config.location=/cache/liferay-multi-vm-clustered.xml
  </code></pre>
  
  <p>Ive also created a jsp on all nodes </p>
  
  <pre><code>&lt;td&gt;
    Session ID&lt;/td&gt;
  &lt;td&gt;&lt;%= session.getId() %&gt;&lt;/td&gt;
  &lt;% session.setAttribute("abc","abc"); %&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
    Created on&lt;/td&gt;
    &lt;td&gt;&lt;%= new java.util.Date(session.getCreationTime()).toString() %&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>With the same user i can switch servers and the session seems to be replicated without problems. However i still get the stacktrace when i go modify something in liferay.</p>
  
  <p>Ive been stuck for a while now.
  We have checked that all servers and JVM times are synched correctly with the NTP server.
  No ports are blocked. The server does not have access to the internet.
  They are all running on VM.</p>
  
  <p>Anybody has any ideas what im doing wrong ??</p>
  
  <p>thank you.</p>