我的Tomcat启动地址使用的是0.0.0.0,其他地址也均用localhost来写,所以即使更换了IP,也不应该和Tomcat有什么关系。
何况之前可以正常运行,只是更换IP后报错:
2014-8-19 14:29:28 org.apache.catalina.ha.tcp.SimpleTcpCluster start 严重: Unable to start cluster. org.apache.catalina.tribes.ChannelException: java.net.SocketException: error setting options; No faulty members identified. at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:167) at org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:95) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:147) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:407) at org.apache.catalina.ha.tcp.SimpleTcpCluster.start(SimpleTcpCluster.java:666) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1047) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 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:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: java.net.SocketException: error setting options at java.net.PlainDatagramSocketImpl.join(Native Method) at java.net.PlainDatagramSocketImpl.join(PlainDatagramSocketImpl.java:172) at java.net.MulticastSocket.joinGroup(MulticastSocket.java:276) at org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServiceImpl.java:233) at org.apache.catalina.tribes.membership.McastService.start(McastService.java:374) at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:152) ... 18 more
Linux上换IP后也是报错,内容如下:
Aug 19, 2014 6:00:30 PM org.apache.coyote.http11.Http11NioProtocol init INFO: Initializing Coyote HTTP/1.1 on http-117.135.132.42-8031 Aug 19, 2014 6:00:30 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 579 ms Aug 19, 2014 6:00:30 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Aug 19, 2014 6:00:30 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.39 Aug 19, 2014 6:00:30 PM org.apache.catalina.ha.tcp.SimpleTcpCluster start INFO: Cluster is about to start Aug 19, 2014 6:00:30 PM org.apache.catalina.tribes.transport.ReceiverBase getBind SEVERE: Failed bind replication listener on address:auto java.net.UnknownHostException: .: . at java.net.InetAddress.getLocalHost(InetAddress.java:1402) at org.apache.catalina.tribes.transport.ReceiverBase.getBind(ReceiverBase.java:166) at org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:100) at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:140) at org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:95) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:147) at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:149) at org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:407) at org.apache.catalina.ha.tcp.SimpleTcpCluster.start(SimpleTcpCluster.java:666) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1047) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 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:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
网上也有人说是端口冲突之类的,也有人说是组播问题,不过我认为不应该是这样的。
我的服务器是托管的,大体环境是不可能变的,只是更换一个IP就启动不了,我认为就是和系统内的IP配置有关系。
如上所说,Tomcat没有邦定IP,那么只能往系统上想。
在系统上都有一个hosts文件,Linux也有。更换IP后,也许是hosts里面的配置没有更换,即你需要根据hostname配置hosts里面对应的IP。
例如我的机器名是:v01,那么在hosts里面配置。
文件地址:C:\WINDOWS\system32\drivers\etc\hosts。
1.1.1.1 v01
注意1.1.1.1就是你现在的IP地址。
Linux下使用命令hostname查看当前机器名,然后到修改/etc/hosts文件,也是不当前IP对应上当前的机器名。
推荐您阅读更多有关于“ Tomcat 无法启动 hosts SocketException hostname ”的文章
Java小强
未曾清贫难成人,不经打击老天真。
自古英雄出炼狱,从来富贵入凡尘。
发表评论: