我在windows下安装用Vmware+Redhat,配置apache+tomcat+负载均衡的时候,出现了一个很奇怪的问题:
注意到:
信息: Initializing ProtocolHandler ["http-bio-8080"]
2011-8-2 19:59:24 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2011-8-2 19:59:24 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 732 ms
2011-8-2 19:59:24 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2011-8-2 19:59:24 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.19
2011-8-2 19:59:24 org.apache.catalina.ha.tcp.SimpleTcpCluster startInternal
信息: Cluster is about to start
2011-8-2 19:59:25 org.apache.catalina.tribes.transport.ReceiverBase bind
信息: Unable to bind server socket to:/192.168.137.3:4099 throwing error.
2011-8-2 19:59:25 org.apache.catalina.tribes.transport.nio.NioReceiver start
严重: Unable to start cluster receiver
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
at org.apache.catalina.tribes.transport.ReceiverBase.bind(ReceiverBase.java:231)
at org.apache.catalina.tribes.transport.nio.NioReceiver.bind(NioReceiver.java:138)
at org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:107)
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:145)
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:153)
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:653)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1024)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
2011-8-2 19:59:25 org.apache.catalina.ha.tcp.SimpleTcpCluster startInternal
严重: Unable to start cluster.
org.apache.catalina.tribes.ChannelException: java.net.BindException: Cannot assign requested address; 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:153)
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:653)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1024)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
at org.apache.catalina.tribes.transport.ReceiverBase.bind(ReceiverBase.java:231)
at org.apache.catalina.tribes.transport.nio.NioReceiver.bind(NioReceiver.java:138)
at org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:107)
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:145)
... 22 more
2011-8-2 19:59:25 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
org.apache.catalina.LifecycleException: org.apache.catalina.tribes.ChannelException: java.net.BindException: Cannot assign requested address; No faulty members identified.
at org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1024)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: org.apache.catalina.tribes.ChannelException: java.net.BindException: Cannot assign requested address; 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:153)
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:653)
... 15 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
at org.apache.catalina.tribes.transport.ReceiverBase.bind(ReceiverBase.java:231)
at org.apache.catalina.tribes.transport.nio.NioReceiver.bind(NioReceiver.java:138)
at org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:107)
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:145)
... 22 more
2011-8-2 19:59:25 org.apache.catalina.startup.Catalina start
信息: Server startup in 703 ms
Unable to bind server socket to:/192.168.137.3:4099 throwing erro
这句到底是在哪里进行配置,我的虚拟机里怎么会与192.168.137.3:4099绑定,找到下面那条语句:
org.apache.catalina.tribes.transport.nio.NioReceiver
最后,终于知道是配置文件server.xml文件出错了
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto" //把这个改为localhost或都自己的ip都可以;如果用auto的话,在vmware里会与主机的实际ip产生冲突,原因不知道是什么,呵呵。
port="4000"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
重新启动tomcat,感觉世界又美好了些!