zhujianlin0 2019-07-01
发布Java应用到阿里云,启动失败,部分堆栈如下:
at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:502) at java.net.InetAddress.checkLookupTable(InetAddress.java:1393) ... at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress0(NetUtils.java:188) at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress(NetUtils.java:180) at com.alibaba.dubbo.common.utils.NetUtils.getLocalHost(NetUtils.java:146) at com.alibaba.dubbo.common.logger.support.FailsafeLogger.appendContextMessage(FailsafeLogger.java:40) at com.alibaba.dubbo.common.logger.support.FailsafeLogger.warn(FailsafeLogger.java:110) at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress0(NetUtils.java:220) at com.alibaba.dubbo.common.utils.NetUtils.getLocalAddress(NetUtils.java:180) at com.alibaba.dubbo.common.utils.NetUtils.getLocalHost(NetUtils.java:146) at com.alibaba.dubbo.common.logger.support.FailsafeLogger.appendContextMessage(FailsafeLogger.java:40)
看了代码,发现是dubbo的小bug:getLocalHost失败会调用日志打印,日志打印的时候会自动带上本机域名(调用getLocalHost),造成循环调用。
2种解决方法:
指定域名解析的方式还有其它用途:daily环境从内网迁移到阿里云,指定解析为外网IP,方便在内网调用。