You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/05/19 15:48:05 UTC

[GitHub] [pulsar] MishaKut opened a new issue #10643: Error when following getting started with Java libraries

MishaKut opened a new issue #10643:
URL: https://github.com/apache/pulsar/issues/10643


   - Linux Mint 20
   - Intellij IDEA 2021.1.1
   - PulsarVersion = 2.7.1
   
   I'm trying to get started with Pulsar ([source](https://pulsar.apache.org/docs/en/client-libraries-java/)) in Intellij IDEA, but I'm facing with a problem: I can not create a producer because of client uses port. I suppose that the mistake is very simple and stupid, but can not find the reason).
   
   A producer is created within 30 seconds, after that I get an error:
   
       org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.ExecutionException: org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:6650
   	    at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:978)
   	    at org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:94)
   	    at BrokerStarter.main(BrokerStarter.java:26)
       Caused by: java.util.concurrent.ExecutionException: org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:6650
   	    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
   	    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
   	    at org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:92)
   	    ... 1 more
       Caused by: org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:6650
   	    at org.apache.pulsar.client.impl.ConnectionPool.lambda$null$9(ConnectionPool.java:217)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
   	    at org.apache.pulsar.shade.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   	    at java.lang.Thread.run(Thread.java:748)
       Caused by: java.util.concurrent.CompletionException: org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:6650
   	    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
   	    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
   	    at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:661)
   	    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:646)
   	    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
   	    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
   	    at org.apache.pulsar.common.util.netty.ChannelFutures.lambda$toCompletableFuture$0(ChannelFutures.java:59)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:570)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:549)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.fulfillConnectPromise(AbstractEpollChannel.java:636)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:655)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:529)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:465)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
   	    ... 4 more
       Caused by: org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:6650
       Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
   	    at org.apache.pulsar.shade.io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)
   	    at org.apache.pulsar.shade.io.netty.channel.unix.Socket.finishConnect(Socket.java:243)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:672)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:649)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:529)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:465)
   	    at org.apache.pulsar.shade.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
   	    at org.apache.pulsar.shade.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
   	    at org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   	    at java.lang.Thread.run(Thread.java:748)
       
       Process finished with exit code 0
   
   
   code:
   
   
   
       public class PulsarStarter {
           public static void main(String[] args) throws PulsarClientException {
                   PulsarClient client = null;
                   Producer<byte[]> producer = null;
       
               try {
       
                   String localClusterUrl = "pulsar://localhost:6650";
       
                   client = PulsarClient.builder().serviceUrl(localClusterUrl)
                           .build();
                   producer = client
                           .newProducer()
                           .topic("my-topic")
                           .create();
       
                   producer.send("My message".getBytes());
       
               } catch (Exception e) {
                   e.printStackTrace();
               } finally {
                   if (producer != null) {
                       System.out.println("closing producer: " + producer);
                       producer.close();
                   }
                   if (client != null) {
                       System.out.println("closing client: " + client);
                       client.close();
                   }
               }
           }
       }
   
   
   `build.gradle`
   
   
   
       plugins {
           id 'java'
       }
       
       group 'org.example'
       version '1.0-SNAPSHOT'
       
       repositories {
           mavenCentral()
       }
       
       def pulsarVersion = '2.7.1'
       
       dependencies {
           compile group: 'org.apache.pulsar', name: 'pulsar-client', version: pulsarVersion
           compile 'org.slf4j:slf4j-nop:1.7.13'
       }
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] MishaKut commented on issue #10643: Error when following getting started with Java libraries

Posted by GitBox <gi...@apache.org>.
MishaKut commented on issue #10643:
URL: https://github.com/apache/pulsar/issues/10643#issuecomment-846949594


   > Hi @MishaKut, looks like the broker is not started?
   
   HI! Looks like you are right. This the only information I have...
   I tried to initiate time out after an initialization of broker to give some time to start or throw more specific error. But nothing changed - initialization of producer still fails. But I do not get any errors due to broker... 
   
   code example with timeout:
   
   `
   
              client = PulsarClient.builder().serviceUrl(localClusterUrl)
                       .build();
   
              Thread.sleep(60_000);
   
               producer = client
                       .newProducer()
                       .topic("my-topic")
                       .create();
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on issue #10643: Error when following getting started with Java libraries

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #10643:
URL: https://github.com/apache/pulsar/issues/10643#issuecomment-1058890144


   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on issue #10643: Error when following getting started with Java libraries

Posted by GitBox <gi...@apache.org>.
zymap commented on issue #10643:
URL: https://github.com/apache/pulsar/issues/10643#issuecomment-845616821


   Hi @MishaKut, looks like the broker is not started?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org