question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException

See original GitHub issue

Expected behavior

I try pulsar example . just start pulsar standalone in ubuntu. the ip is 192.168.1.25

ubuntu version: Linux afistest17 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux jdk version:1.8.0_111 pulsar version :1.17.5

the pulsar client is in window10 . I just want to test the simple producer demo .

the code below:

	PulsarClient client = PulsarClient.create("pulsar://192.168.1.25:6650");

	Producer producer = client.createProducer(
	            "persistent://sample/standalone/ns1/my-topic");

	// Publish 10 messages to the topic
	for (int i = 0; i < 10; i++) {
	    producer.send("my-message".getBytes());
	}

	client.close();

but exception occur

2017-05-10 14:16:18.043 [INFO ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.ProducerStats - Starting Pulsar producer perf with config: {
  "sendTimeoutMs" : 30000,
  "maxPendingMessages" : 1000,
  "blockIfQueueFull" : true,
  "batchingMaxPublishDelayMs" : 10,
  "batchingMaxMessages" : 1000,
  "batchingEnabled" : false,
  "compressionType" : "NONE",
  "messageRoutingMode" : "SinglePartition"
}
2017-05-10 14:16:18.052 [INFO ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.ProducerStats - Pulsar client config: {
  "authentication" : {
    "authData" : {
      "tlsPrivateKey" : null,
      "httpHeaders" : null,
      "commandData" : null,
      "httpAuthType" : null,
      "tlsCertificates" : null
    },
    "authMethodName" : "none"
  },
  "operationTimeoutMs" : 30000,
  "statsIntervalSeconds" : 60,
  "connectionsPerBroker" : 1,
  "useTcpNoDelay" : true,
  "useTls" : false,
  "tlsTrustCertsFilePath" : "",
  "tlsAllowInsecureConnection" : false,
  "concurrentLookupRequest" : 5000,
  "maxNumberOfRejectedRequestPerConnection" : 50,
  "ioThreads" : 1,
  "listenerThreads" : 1
}
2017-05-10 14:16:18.142 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:18.143 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:29.419 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:29.420 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:29.420 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 0.116 s
2017-05-10 14:16:29.538 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:29.543 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:29.544 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:29.544 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:29.545 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:29.545 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 0.205 s
2017-05-10 14:16:29.750 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:29.754 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:29.754 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:29.754 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:29.754 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:29.754 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 0.406 s
2017-05-10 14:16:30.161 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:30.165 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:30.165 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:30.165 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:30.165 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:30.165 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 0.93 s
2017-05-10 14:16:31.097 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:31.100 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:31.100 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:31.100 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:31.101 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:31.101 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 1.881 s
2017-05-10 14:16:32.983 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:32.986 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:32.986 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:32.986 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:32.987 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:32.987 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 3.295 s
2017-05-10 14:16:36.283 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:36.286 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:36.286 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:36.287 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:36.287 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:36.287 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Could not get connection to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException -- Will try again in 7.587 s
2017-05-10 14:16:43.875 [INFO ] [pulsar-timer-3-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Reconnecting after connection was closed
2017-05-10 14:16:43.878 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd LOOKUP_RESPONSE
2017-05-10 14:16:43.878 [INFO ] [pulsar-client-io-1-1] c.yahoo.pulsar.client.impl.ClientCnx - Received Broker lookup response: Connect
2017-05-10 14:16:55.154 [DEBUG] [pulsar-client-io-1-1] c.y.p.client.impl.ConnectionPool - Connection for afistest25:6650 not found in cache
2017-05-10 14:16:55.154 [WARN ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.HandlerBase - [persistent://sample/standalone/ns1/my-topic] [null] Error connecting to broker: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
2017-05-10 14:16:55.154 [INFO ] [pulsar-client-io-1-1] c.y.pulsar.client.impl.ProducerImpl - [persistent://sample/standalone/ns1/my-topic] Producer creation failed for producer 0
Exception in thread "main" 2017-05-10 14:16:55.155 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarHandler - [[id: 0x3a37c3e0, L:/192.168.1.170:50492 - R:/192.168.1.25:6650]] Sending ping message
com.yahoo.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
	at com.yahoo.pulsar.client.impl.HandlerBase.handleConnectionError(HandlerBase.java:80)
	at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870)
	at java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:852)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
	at com.yahoo.pulsar.client.impl.ConnectionPool.lambda$2(ConnectionPool.java:135)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)
	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427)
	at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:129)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:239)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1226)
	at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:549)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:534)
	at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:516)
	at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:970)
	at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:215)
	at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:408)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:402)
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.CompletionException: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
	at java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:326)
	at java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:338)
	at java.util.concurrent.CompletableFuture.uniRelay(CompletableFuture.java:911)
	at java.util.concurrent.CompletableFuture$UniRelay.tryFire(CompletableFuture.java:899)
	... 20 more
Caused by: com.yahoo.pulsar.client.api.PulsarClientException: java.nio.channels.UnresolvedAddressException
	... 18 more
Caused by: java.nio.channels.UnresolvedAddressException
	at sun.nio.ch.Net.checkAddress(Net.java:101)
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
	at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:208)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:203)
	... 12 more
2017-05-10 14:16:55.157 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd PING
2017-05-10 14:16:55.157 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarHandler - [[id: 0x3a37c3e0, L:/192.168.1.170:50492 - R:/192.168.1.25:6650]] Replying back to ping message
2017-05-10 14:16:55.161 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd PONG
2017-05-10 14:17:17.192 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarHandler - [[id: 0x3a37c3e0, L:/192.168.1.170:50492 - R:/192.168.1.25:6650]] Sending ping message
2017-05-10 14:17:17.194 [DEBUG] [pulsar-client-io-1-1] c.y.pulsar.common.api.PulsarDecoder - [/192.168.1.25:6650] Received cmd PONG

System configuration

Pulsar version: 1.17.5

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sunning9001commented, May 12, 2017

@jai1 @merlimat thanks ,very much ! very sorry for spentding your a lot of time.
I change to another VMmave . just ok .

1reaction
merlimatcommented, May 11, 2017

@sunning9001 yes, it looks like the same issue on the bookie as well… bookies are advertising the private IP.

You can fix that by specifying which network interface you want the bookie to listen. In conf/bookkeeper.conf:

# Set the network interface that the bookie should listen on.
# If not set, the bookie will listen on all interfaces.
#listeningInterface=eth0

So if you don’t set the listeningInterface it will listen on 0.0.0.0, but it will advertise only the IP associated with the hostname (which typically is the correct choice).

Just out of curiosity, what kind of environment are you testing into? Any cloud provider?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package org.apache.pulsar.client.api
Interface for accessing data which are used in variety of authentication schemes on client side. ClientBuilder. Builder interface that is used to construct ......
Read more >
UnresolvedAddressException - Talend Community
Hi Working on windows 7. getting this exception. Starting job Test at 22:42 08/06/2016. connecting to socket on port 3440 connected
Read more >
com.yahoo.pulsar.client.impl.ConsumerBase.java Source code
Here is the source code for com.yahoo.pulsar.client.impl.ConsumerBase.java ... FutureUtil; import com.yahoo.pulsar.common.api.proto.PulsarApi.CommandAck.
Read more >
Error during handshake for tls auth by apache pulsar client on ...
Hi, I have a similar issue, creating unit test, giving me an an exception: org.apache.pulsar.client.api.PulsarClientException$InvalidServiceURL: ...
Read more >
Getting Started with the Apache Pulsar Java Client - Medium
Get hands-on with Apache Pulsar's Java client and create a message producer and ... distributed platform for streaming and messaging created by Yahoo....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found