apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED #6015

Open DJuR opened 1 year ago

DJuR commented 1 year ago

code:

 public static void main(String[] args) throws ClientException {
        String endpoint = "localhost:9876";
        String topic = "TopicTest";

        ClientServiceProvider clientServiceProvider = ClientServiceProvider.loadService();
        ClientConfigurationBuilder clientConfigurationBuilder = ClientConfiguration.newBuilder().setEndpoints(endpoint);
        ClientConfiguration build = clientConfigurationBuilder.build();
        Producer producer = clientServiceProvider.newProducerBuilder().setTopics(topic)
                .setClientConfiguration(build)
                .build();

        Message message = clientServiceProvider.newMessageBuilder()
                .setTag(topic)
                .setKeys("messageKey")
                .setTag("messageTag")
                .setBody("messageBody".getBytes(StandardCharsets.UTF_8))
                .build();

        SendReceipt send = producer.send(message);
        System.out.println(send.getMessageId());

    }

Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]

Guts17 commented 1 year ago

I have got the same problem.

Guts17 commented 1 year ago

It seems to be a common problem on windows.

aaron-ai commented 1 year ago

ALPN negotiation is not successful in some platform, it is related to the TLS part of gRPC.

we plan to provide the TLS options recently so that you could turn it off.

jiangyklala commented 1 year ago

Is there some advice ? I have the problem too.

aaron-ai commented 1 year ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

gongzh021 commented 1 year ago

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder

Which version of SDK is this class under?

I'm using "rocketmq-client-java-5.0.4.jar"

aaron-ai commented 1 year ago

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder

Which version of SDK is this class under?

I'm using "rocketmq-client-java-5.0.4.jar"

5.0.5

gongzh021 commented 1 year ago

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder Which version of SDK is this class under? I'm using "rocketmq-client-java-5.0.4.jar"

5.0.5

I still can't seem to use the SDK of 5.0.5.

ERROR:

Exception in thread "main" java.lang.IllegalStateException: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:381) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:305) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:165) at org.apache.rocketmq.client.java.impl.producer.ProducerBuilderImpl.build(ProducerBuilderImpl.java:93) at rocketmq_0415.ProducerExample.main(ProducerExample.java:29) Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91) at org.apache.rocketmq.client.java.impl.ClientImpl.startUp(ClientImpl.java:188) at org.apache.rocketmq.client.java.impl.producer.ProducerImpl.startUp(ProducerImpl.java:114) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason at org.apache.rocketmq.shaded.io.grpc.Status.asRuntimeException(Status.java:539) at org.apache.rocketmq.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544) at org.apache.rocketmq.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) at org.apache.rocketmq.shaded.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at org.apache.rocketmq.shaded.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more

aaron-ai commented 1 year ago

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

gongzh021 commented 1 year ago

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

I would like to ask, is this a problem only in the new version, or is this a problem in all versions?

aaron-ai commented 1 year ago

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

I would like to ask, is this a problem only in the new version, or is this a problem in all versions?

This is theoretically an issue that only appears in relatively old server and client versions, and currently most of them are seen on Windows platforms.

KevinWang12138 commented 1 year ago

I meet this problem too, but my situtation is the broker and nameServer run on my Cloud Server, and Client run on my MAC. The problem appear beacuse the broker send the intranet address to nameServer, so my MAC cannot connect it.

The way I solve the problem is I add these to the 'broker.conf'-- brokerIP1=... brokerIP2=... namesrvAddr=localhost:9876

and you should change ... to your public address.

To know more detail infomation, please check this blog from chinese website:https://blog.csdn.net/jpf254/article/details/80748021

I dont know the final reason why that can solve the problem, I need to see the source code!

plutoyty commented 1 year ago

I have got the same problem.

plutoyty commented 1 year ago

I have got the same problem.

Exception in thread "main" java.lang.IllegalStateException: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:381) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:305) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:165) at org.apache.rocketmq.client.java.impl.producer.ProducerBuilderImpl.build(ProducerBuilderImpl.java:93) at RocketMQ.ProducerExample.main(ProducerExample.java:31) Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0] at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91) at org.apache.rocketmq.client.java.impl.ClientImpl.startUp(ClientImpl.java:188) at org.apache.rocketmq.client.java.impl.producer.ProducerImpl.startUp(ProducerImpl.java:114) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0] at org.apache.rocketmq.shaded.io.grpc.Status.asRuntimeException(Status.java:539) at org.apache.rocketmq.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544) at org.apache.rocketmq.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) at org.apache.rocketmq.shaded.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at org.apache.rocketmq.shaded.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more

lipeimin commented 1 year ago

我们项目中使用canal监听binlog,当数据写入rocket后, 消费时项目无法启动,报错如下: image 目前rocket安装在测试机上,配置文件没有限制http或https请求方式,我们使用的rocket版本是5.0.4,无法设置enablessl选项,请教大佬目前情况该怎么解决,谢谢

jc0803kevin commented 1 year ago

rocket版本是升级到 5.0.5

AI1186780944 commented 1 year ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 `

org.apache.rocketmq
        <artifactId>rocketmq-client-java</artifactId>
        <version>5.0.5</version>
    </dependency>`

image image image

服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

jc0803kevin commented 1 year ago

你安装的rocketmq 的客户端的版本是多少?

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年7月31日(星期一) 晚上11:50 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [apache/rocketmq] Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED (Issue #6015)

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

jc0803kevin commented 1 year ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency>

image image image

服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

AI1186780944 commented 1 year ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

jc0803kevin commented 1 year ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

没有设置账户密码,是可以不填的。连接使用的端口是proxy的端口,不是9876. 例如proxy.json配置为 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" }

那连接的 endpoints = "localhost:18082"

AI1186780944 commented 1 year ago

grpcServerPort

非常感谢。按照您的方案,已经解决了这个问题。

01codingworld commented 1 year ago

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

ipyton commented 7 months ago

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

麻烦死了,我去用Kafka了

bruce256 commented 2 months ago

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

我也遇到了UNAVAILABLE: Network closed for unknown reason,用你的这个方法修改好了

MmringZee commented 2 months ago

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

官方文档里的部署真的不知道介绍了个啥, 部署起来稍微要改一点配置信息都不知道去哪里找, 全靠搜

EightyOliveira commented 1 month ago

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the [related link](https://github.com/apache/rocketmq-clients/blob/master/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfigurationBuilder.java#:~:text=ClientConfigurationBuilder-,enableSsl,-()).

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

没有设置账户密码,是可以不填的。连接使用的端口是proxy的端口,不是9876. 例如proxy.json配置为 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" }

那连接的 endpoints = "localhost:18082"

如果使用rocketmq-client sdk,应该是使用proxy中grpc端口 例如 10.0.0.1 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" } 10.0.0.2 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" } String ENDPOINTS = "10.0.0.1:18081;10.0.0.2:18081"; 虽然用remoting一样可以成功

1725781300171