java WEB 项目在其他机器,任何web容器部署都能正常启动,但是有台机器部署后,启动就报如下错误:
警告: RMI TCP Accept-59825: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,po
rt=0,localport=59825] throws
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:390)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTr
ansport.java:369)
at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:3
41)
at java.lang.Thread.run(Thread.java:662)
紧接着循环报如下错误:
严重: Error receiving heartbeat. Socket closed. Initial cause was Socket closed
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java
:136)
at java.net.DatagramSocket.receive(DatagramSocket.java:725)
at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceiver$Multi
castReceiverThread.run(MulticastKeepaliveHeartbeatReceiver.java:124)
2015-5-6 15:22:31 net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceive
r$MulticastReceiverThread run
通过分析,应该是最上面的错误导致后面错误的产生。而且在应用启动中如果不进行数据库操作,启动就不会报错,从而可以判断应该是网络的问题。
通过网上资料和日志分析,在java启动命令中增加一个属性配置
-Djava.net.preferIPv4Stack=true
启动应用,成功。