Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not create connection to server xxxxxxx - NSQConsumer.createConnection #46

Open
Bwjh opened this issue Mar 6, 2018 · 1 comment

Comments

@Bwjh
Copy link

Bwjh commented Mar 6, 2018

Producer works fine, but consumer can not start . Stacktrace may like this:

com.github.brainlag.nsq.exceptions.NoConnectionsException: Could not connect to server
at com.github.brainlag.nsq.Connection.(Connection.java:62) ~[nsq-client-1.0.0.RC4.jar:?]
at com.github.brainlag.nsq.NSQConsumer.createConnection(NSQConsumer.java:80) ~[nsq-client-1.0.0.RC4.jar:?]
at com.github.brainlag.nsq.NSQConsumer.connect(NSQConsumer.java:210) ~[nsq-client-1.0.0.RC4.jar:?]
at com.github.brainlag.nsq.NSQConsumer.lambda$start$0(NSQConsumer.java:73) ~[nsq-client-1.0.0.RC4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call$$$capture(Executors.java:511) [?:1.8.0_144]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java) [?:1.8.0_144]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:101) ~[?:1.8.0_144]
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622) ~[?:1.8.0_144]
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:208) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:203) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1226) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:549) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:534) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:549) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:534) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:516) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:970) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:215) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:166) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:408) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:402) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) ~[netty-all-4.0.39.Final.jar:4.0.39.Final]
... 1 more

How can I fix this?

@jayantjain93
Copy link

As you can see the cause of the Exception is:
Caused by: java.nio.channels.UnresolvedAddressException
Can you try to make sure if you can resolve the address for your hostname where the nsqd is hosted from your environment.
Try running the following command for linux to know if your environment is able to resolve the hostname.
$ dig +short hostname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants