我参考http://www.blogjava.net/killme2008/archive/2007/03/13/103607.html 实现session共享。
然后我把我的工程放到tomcat 里面去。启动不报错。点击登录的时候就登录不进去。多次点击登录按钮
会进入到主界面然后又强制退出到登录界面。
我的tomcat集群版本是
Apache 2.2.25
Tomcat-7.0.55
点击登录的时候报:
严重: Manager [localhost#/MesLLong]: Unable to receive message through TCP channel
java.lang.IllegalArgumentException: Session id mismatch, not executing the delta request
at org.apache.catalina.ha.session.DeltaRequest.execute(DeltaRequest.java:160)
at org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1280)
at org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1226)
at org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:944)
at org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:9
1)
at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:936)
at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:917)
at org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:278)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java
:82)
at org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector
.java:117)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java
:82)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java
:82)
at org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.messageReceived(ThroughputInter
ceptor.java:90)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java
:82)
at org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:252)
at org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:287)
at org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:21
0)
at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:99)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)。
解决方案:
经过这几天的网上查找资料。问题终于解决。原来是我在tomcat中server.xml中中的值设置错误。替换代码如下
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false" notifyListenersOnReplication="true" />
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.10" port="45564" frequency="500" dropTime="3000" />
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto" port="4000" autoBind="100" ***orTimeout="5000"
maxThreads="6" />
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" timeout="30000" />
</Sender>
<Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
<Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor" />
</Channel>
<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=".*\.gif;.*\***;.*\.jpg;.*\.png;.*\.css;.*\.txt;" />
<ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener" />
</Cluster>