On Nov 20, 2012, at 5:53 AM, Stephen Nelson-Smith wrote: > Hi, > > I'm trying to test simple session sharing using SimpleTCPCluster on > Tomcat 7.0.32. > > Following the documentation, I've uncommented the <Cluster > className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> element, and > ensured <distributable /> is in the web.xml of the examples web app. > > From the docs: > > - All your session attributes must implement java.io.Serializable > > I know the webapps don't, but for proof of concept this is fine. My > real app does. > > - Uncomment the Cluster element in server.xml > > Done. > > - If you have defined custom cluster valves, make sure you have the > ReplicationValve defined as well under the Cluster element in > server.xml > > I haven't. > > - If your Tomcat instances are running on the same machine, make sure > the tcpListenPort attribute is unique for each instance, in most cases > Tomcat is smart enough to resolve this on it's own by autodetecting > available ports in the range 4000-4100 > > I have 2 x VMs running on CentOS 6.3, on different IPs > > - Make sure your web.xml has the <distributable/> element > > Done. > > - If you are using mod_jk, make sure that jvmRoute attribute is set at > your Engine <Engine name="Catalina" jvmRoute="node01" > and that the > jvmRoute attribute value matches your worker name in > workers.properties > > I'm not. > > - Make sure that all nodes have the same time and sync with NTP service! > > Done. > > - Make sure that your loadbalancer is configured for sticky session mode. > > Done (I'm using haproxy). > > However, on starting Tomcat, I see: > > Nov 20, 2012 10:50:16 AM org.apache.catalina.startup.Catalina start > SEVERE: Catalina.start: > org.apache.catalina.LifecycleException: Failed to start component > [StandardServer[8005]] > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) > at org.apache.catalina.startup.Catalina.start(Catalina.java:684) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:601) > at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) > Caused by: org.apache.catalina.LifecycleException: Failed to start > component [StandardService[Catalina]] > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) > at > org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > ... 7 more > Caused by: org.apache.catalina.LifecycleException: Failed to start > component [StandardEngine[Catalina]] > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) > at > org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > ... 9 more > Caused by: org.apache.catalina.LifecycleException: Failed to start > component [org.apache.catalina.ha.tcp.SimpleTcpCluster[Catalina]] > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) > at > org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1106) > at > org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > ... 11 more > Caused by: org.apache.catalina.LifecycleException: > org.apache.catalina.tribes.ChannelException: > java.lang.IllegalArgumentException: java.net.UnknownHostException: > auto: Name or service not known; No faulty members identified. > at > org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:674) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > ... 14 more > Caused by: org.apache.catalina.tribes.ChannelException: > java.lang.IllegalArgumentException: java.net.UnknownHostException: > auto: Name or service not known; No faulty members identified. > at > org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:178) > at > org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:99) > at > org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162) > at > org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162) > at > org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:157) > at > org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162) > at > org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:419) > at > org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:669) > ... 15 more > Caused by: java.lang.IllegalArgumentException: > java.net.UnknownHostException: auto: Name or service not known > at > org.apache.catalina.tribes.membership.McastService.setLocalMemberProperties(McastService.java:182) > at > org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:147) > ... 22 more > Caused by: java.net.UnknownHostException: auto: Name or service not known > at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) > at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866) > at > java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) > at java.net.InetAddress.getAllByName0(InetAddress.java:1211) > at java.net.InetAddress.getAllByName(InetAddress.java:1127) > at java.net.InetAddress.getAllByName(InetAddress.java:1063) > at java.net.InetAddress.getByName(InetAddress.java:1013) > at > org.apache.catalina.tribes.membership.MemberImpl.setHostname(MemberImpl.java:598) > at > org.apache.catalina.tribes.membership.MemberImpl.<init>(MemberImpl.java:142) > at > org.apache.catalina.tribes.membership.McastService.setLocalMemberProperties(McastService.java:173) > ... 23 more > > Nov 20, 2012 10:50:16 AM org.apache.catalina.startup.Catalina start > INFO: Server startup in 285 ms
I've encountered this with Tomcat clustering on CentOS in the past. Tomcat's default configuration for the cluster receiver will automatically look up the address to listen. It does this by calling "java.net.InetAddress.getLocalHost().getHostAddress()" [1]. I can't remember exactly why this was failing for me on CentOS, but I'm almost certain it was due to a problem with /etc/hosts. I'd suggest taking a look at that file and making sure it contains the right entries. Otherwise, you can override the default Tomcat setting for the cluster receiver's address attribute, which is "auto" and specify the address manually. That should workaround the problem. [1] - https://tomcat.apache.org/tomcat-7.0-doc/config/cluster-receiver.html#Common%20Attributes (see "address") Dan > > I can connect to the machine on port 8080, but nothing is served: > > # telnet 10.1.1.214 8080 > Trying 10.1.1.214... > Connected to 10.1.1.214. > Escape character is '^]'. > get / http/1.0 > > ... > ... > ... > > I've obviously missed something, but I'm afraid I'm out of ideas. Any > suggestions most welcome. > > Thanks in advance, > > S. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org