rocketmq: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED

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]

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

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

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> 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”