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.

Exception thrown when publishing an event using DaprClient from Java SDK of Dapr

See original GitHub issue

In what area(s)?

I am using io.dapr.client.DaprClient -> publishEvent(String var1, Object var2):

com.fasterxml.jackson.databind.ObjectMapper om = ObjectMapper();
...
try {
            publisher.publishEvent(
                    "core.adapters.delete",
                    om.writeValueAsBytes(bc)).doOnError(
                        throwable -> LOG.error(throwable.getMessage(), throwable))
                        .subscribe(
                                value -> LOG.trace("Subscribed to published event: {}", value),
                                err -> LOG.error(err.getMessage(), err),
                                () -> LOG.trace("Publishing completed")
                        );
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }

I tried the code yesterday with a topic that already exists. Yesterday it was successful. Tried it today with a new topic, then the exception occurred. Then tried again the old topic, also in this case the exception occurs. There comes no exception at startup. When I call the above code to publish an event, the exception occurrs.

/area runtime Windows Java JDK 12.0.2 No company proxy involved. On local machine

What version of Dapr?

dapr java sdk 0.3.0

Expected Behavior

Events can be published without exception

Actual Behavior

When an event is published, I get following exception: 2020/03/25T16:03:55.697 core [http-nio-8081-exec-2] ERROR c.b.r.s.r.a.s.BundlesServiceImplementation.lambda$publishAdapterEvent$3(486) - io.grpc.StatusRuntimeException: UNAVAILABLE: io exception [161818, , Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36] java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552) at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:533) at io.dapr.client.DaprClientGrpc.lambda$publishEvent$0(DaprClientGrpc.java:91) at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:56) at reactor.core.publisher.Mono.subscribe(Mono.java:4087) at reactor.core.publisher.Mono.subscribeWith(Mono.java:4193) at reactor.core.publisher.Mono.subscribe(Mono.java:4059) at reactor.core.publisher.Mono.subscribe(Mono.java:3995) at com.bosch.riot.server.ServiceImpl.publishAdapterEvent(ServiceImpl.java:487) at com.bosch.riot.server.Controller$$FastClassBySpringCGLIB$$de67ea92.invoke(<generated>) … at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:835) Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at io.grpc.Status.asRuntimeException(Status.java:533) at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:495) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510) at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:692) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:681) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) … 1 common frames omitted Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: /127.0.0.1:50051 Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779) at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:688) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:835)

Steps to Reproduce the Problem

  • local components folder contains a pubsub.yaml file with following config:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: messagebus
spec:
  type: pubsub.azure.servicebus
  metadata:
    - name: connectionString
      value: "Endpoint=sb://riot...-> from azure portal primary connection string"

Started first the normal java application (that has no subscription endpoints). Then the Dapr side car. When I call then the exposed REST API from the java application an event should be published. Yesterday with the known topic this worked. Today I had to use a new topic, then the exception occurred.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
artursouzacommented, May 6, 2020

That explains it. We are fixing that today.

1reaction
paguflercommented, Mar 26, 2020

Hi @artursouza,

seams that yesterday my head was not really working… Mistakenly took a connection string that was already taken by someone else. Then we get this error msg. Would be good to have a hint, that a connection string is used twice.

This bug can therefore be closed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dapr Java SDK
The Java SDK allows you to interface with all of the Dapr building blocks. Invoke a service. Copy. import io.dapr.client.DaprClient ...
Read more >
Dapr Java SDK
The Java SDK allows you to interface with all of the Dapr building blocks. Invoke a service. Copy. import io.dapr.client ...
Read more >
DaprClient usage - Dapr Docs
Essential tips and advice for using DaprClient. ... When an operation is cancelled, it will throw an OperationCancelledException .
Read more >
How to: Publish a message and subscribe to a topic | Dapr Docs
Learn how to send messages to a topic with one service and subscribe to that topic in another service.
Read more >
Quickstart: Publish and Subscribe - Dapr Docs
with DaprClient () as client: # Publish an event/message using Dapr PubSub result = client.publish_event( pubsub_name='orderpubsub', ...
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