问题描述
我正在尝试运行以下vertx教程,但遇到了此异常。
i am trying to run the following vertx tutorial but stuck on this exception.
我试图只运行单个服务或整个项目,但异常也一样。
i have tried to run just single service or the whole project the exception is coming the same.
我缺少任何码头工人设置吗?
any docker setting i am missing?
ov 03, 2016 10:35:55 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
cache-infrastructure_1 | INFO: Succeeded in deploying verticle
inventory-microservice_1 | java.net.UnknownHostException: failed to resolve 'inventory-microservice'. Exceeded max queries per resolve 3
inventory-microservice_1 | at io.netty.resolver.dns.DnsNameResolverContext.finishResolve(DnsNameResolverContext.java:476)
inventory-microservice_1 | at io.netty.resolver.dns.DnsNameResolverContext.tryToFinishResolve(DnsNameResolverContext.java:398)
inventory-microservice_1 | at io.netty.resolver.dns.DnsNameResolverContext$3.operationComplete(DnsNameResolverContext.java:193)
inventory-microservice_1 | at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
inventory-microservice_1 | at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)
inventory-microservice_1 | at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427)
inventory-microservice_1 | at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:102)
inventory-microservice_1 | at io.netty.resolver.dns.DnsQueryContext.setSuccess(DnsQueryContext.java:195)
inventory-microservice_1 | at io.netty.resolver.dns.DnsQueryContext.finish(DnsQueryContext.java:178)
inventory-microservice_1 | at io.netty.resolver.dns.DnsNameResolver$DnsResponseHandler.channelRead(DnsNameResolver.java:694)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350)
inventory-microservice_1 | at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350)
inventory-microservice_1 | at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
inventory-microservice_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
inventory-microservice_1 | at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
inventory-microservice_1 | at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:93)
inventory-microservice_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:610)
inventory-microservice_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:551)
inventory-microservice_1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:465)
inventory-microservice_1 | at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:437)
inventory-microservice_1 | at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
inventory-microservice_1 | at java.lang.Thread.run(Thread.java:745)
推荐答案
经过大量调试,最后我发现vertx的最新版本有解决主机的问题。因此,通过此选项,我们可以禁用disableDnsResolver(默认情况下为ON)。
After lots of debugging finally i found out the recent version of vertx has issues resolving host. so by this option we can disable the disableDnsResolver which is ON by default. and it worked fine for me
CMD ["java -Dvertx.disableDnsResolver=true -jar account-microservice-fat.jar -cluster -conf docker.json"]
如果尝试运行以上示例,则需要添加-Dvertx。每个微服务的DockerFile中的disableDnsResolver = true
if trying to run above example you need to add -Dvertx.disableDnsResolver=true in DockerFile of everymicroservice
这篇关于java.net.UnknownHostException:无法解析“库存微服务”。超过每个解析的最大查询数3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!