I'm currently working on a Tomcat Cluster for Q&A, but unfortunatly, it seems that the auto deploy of a war across this cluster is not working at all.
I know the cluster is working perfectly because each server are receiving correctly the multicast communications and are aware of any missing host instantly.
The problem here is coming from the FarmWarDeployer function which seems to not working.
Indeed, when I upload a war, using the tomcat manager, or a simple SFTPd push, on the node1 of my cluster, the war is unpacked and used by the node1, but, it's not sent to my node 2. Instead, my node1 is saying:
WARNING: Manager [localhost#/APPTest##1.0.0]: No context manager send at 9/14/12 5:21 PM received in 103 ms.
and my node2 is claiming:
WARNING: Context manager doesn't exist:localhost#/APPTest##1.0.0
well, my APPTest is correctly set with the tag and the cluster is correctly receiving session if I manually push the application on the node2.
So, about me, the problem is coming from my FarmWarDeployer Settings which are:
103 <Engine name="Catalina" defaultHost="localhost">
104
105
106
107 <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
108 channelSendOptions="8">
109
110 <Manager className="org.apache.catalina.ha.session.DeltaManager"
111 expireSessionsOnShutdown="false"
112 notifyListenersOnReplication="true"/>
113
114 <Channel className="org.apache.catalina.tribes.group.GroupChannel">
115 <Membership className="org.apache.catalina.tribes.membership.McastService"
116 address="224.0.0.1"
117 port="45564"
118 frequency="500"
119 dropTime="3000"/>
120 <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
121 address="auto"
122 port="4000"
123 autoBind="100"
124 selectorTimeout="5000"
125 maxThreads="6"/>
126
127 <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
128 <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
129 </Sender>
130 <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
131 <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
132 </Channel>
133
134 <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
135 filter=""/>
136 <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
137
138 <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
139 tempDir="/opt/tomcat/temp/"
140 deployDir="/opt/tomcat/webapps/"
141 watchDir="/opt/tomcat/webapps/"
142 watchEnabled="enable"/>
143
144 <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
145 <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
146 </Cluster>
147
148 <Realm className="org.apache.catalina.realm.LockOutRealm">
149 <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
150 resourceName="UserDatabase"/>
151 </Realm>
152
153 <Host name="localhost" appBase="webapps"
154 unpackWARs="true" autoDeploy="true">
155 </Host>
156 </Engine>
About me there is nothing too strange for a testing cluster, but I'm definitly not a tomcat expert.
So, if something is wrong or missing, let me know ;-)
Your watchDir and deployDir should not be the same location. When tomcat sees a change it will attempt to download this and will have an incomplete stream since nothing is instant. This will cause the errors you are seeing in war deployment. The same scenario could be replicated if you try to scp a war straight to the deploy directory. You first need to stage on the server and than deploy.
Try adding another directory for the watchDir param and than attempt to deploy to that directory and all nodes should pick that up.
FarmWarDeployer can be configured at host level cluster only. Cluster settings move into the
<Host>...</Host>
. It work for me.https://tomcat.apache.org/tomcat-7.0-doc/config/cluster-deployer.html