You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "DoubleJee (via GitHub)" <gi...@apache.org> on 2023/11/17 05:37:25 UTC

[I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

DoubleJee opened a new issue, #637:
URL: https://github.com/apache/rocketmq-clients/issues/637

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
   
   - [X] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions)  of this repository and believe that this is not a duplicate.
   
   - [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
   
   
   ### Programming Language of the Client
   
   Java
   
   ### Runtime Platform Environment
   
   **这是jdk1.8的:**
   
   2023-11-17 11:00:47.038 INFO  [21311] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.c.SimpleConsumerImpl#?:?] - Begin to start the rocketmq simple consumer, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   2023-11-17 11:00:47.040 INFO  [21311] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - Begin to start the rocketmq client, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   2023-11-17 11:00:47.041 INFO  [21311] [ClientManagerImpl-0 STARTING] [o.a.r.c.j.i.ClientManagerImpl#?:?] - Begin to start the client manager, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   2023-11-17 11:00:47.047 INFO  [21311] [ClientManagerImpl-0 STARTING] [o.a.r.c.j.i.ClientManagerImpl#?:?] - The client manager starts successfully, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   2023-11-17 11:00:47.047 INFO  [21311] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - Begin to fetch topic(s) route data from remote during client startup, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d, topics=[topic_post_clicks_local]
   2023-11-17 11:00:48.058 INFO  [21311] [RocketmqClientScheduler-0-1] [o.a.r.c.j.i.ClientManagerImpl#?:?] - Start to log statistics, clientVersion=**5.0.5**, clientWrapperVersion=null, clientEndpoints=隐藏先:8080, os description=[Mac OS X 13.4], java description=[**Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.361-b09**], clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   2023-11-17 11:00:51.583 ERROR [21311] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.c.SimpleConsumerImpl#?:?] - Failed to start the rocketmq simple consumer, try to shutdown it, clientId=gzzdeMacBook-Air.local@21311@0@k2y50xh3d
   java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.917840542s. [buffered_nanos=2926200084, waiting_for_connection]
   	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.consumer.SimpleConsumerImpl.startUp(SimpleConsumerImpl.java:93)
   	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:750)
   Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.917840542s. [buffered_nanos=2926200084, waiting_for_connection]
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   **这是jdk11的能正常连接,代码一样:**
   
   
   2023-11-17 11:09:19.557 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.c.SimpleConsumerImpl#?:?] - Begin to start the rocketmq simple consumer, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:19.558 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - Begin to start the rocketmq client, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:19.558 INFO  [21493] [ClientManagerImpl-0 STARTING] [o.a.r.c.j.i.ClientManagerImpl#?:?] - Begin to start the client manager, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:19.560 INFO  [21493] [ClientManagerImpl-0 STARTING] [o.a.r.c.j.i.ClientManagerImpl#?:?] - The client manager starts successfully, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:19.560 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - Begin to fetch topic(s) route data from remote during client startup, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge, topics=[topic_post_clicks_local]
   2023-11-17 11:09:20.561 INFO  [21493] [RocketmqClientScheduler-0-2] [o.a.r.c.j.i.ClientManagerImpl#?:?] - Start to log statistics, clientVersion=**5.0.5**, clientWrapperVersion=null, clientEndpoints=隐藏先:8080, os description=[Mac OS X 13.4], java description=[**Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 17.0.7+8-LTS-224**], clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:20.583 INFO  [21493] [RocketmqClientAsyncWorker-0-5] [o.a.r.c.j.i.ClientSessionImpl#?:?] - Receive settings from remote, endpoints=dns:rmq-cn-pe33b4ebu0o.cn-shanghai.rmq.aliyuncs.com:8081, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:20.605 INFO  [21493] [RocketmqClientAsyncWorker-0-5] [o.a.r.c.j.m.ClientMeterManager#?:?] - Metrics is on, endpoints=dns:rmq-cn-pe33b4ebu0o.cn-shanghai.rmq.aliyuncs.com:8081, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:20.606 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - Fetch topic route data from remote successfully during startup, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge, topics=[topic_post_clicks_local]
   2023-11-17 11:09:20.606 INFO  [21493] [RocketmqClientAsyncWorker-0-5] [o.a.r.c.j.i.ClientImpl#?:?] - Fetch topic route successfully, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge, topic=topic_post_clicks_local, topicRouteData=TopicRouteData{messageQueueImpls=[rocketmq-broker-rmq-cn-pe33b4ebu0o-0.topic_post_clicks_local.0, rocketmq-broker-rmq-cn-pe33b4ebu0o-0.topic_post_clicks_local.1]}
   2023-11-17 11:09:20.606 INFO  [21493] [RocketmqClientAsyncWorker-0-5] [o.a.r.c.j.i.ClientSessionImpl#?:?] - Init settings successfully, endpoints=dns:rmq-cn-pe33b4ebu0o.cn-shanghai.rmq.aliyuncs.com:8081, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:20.606 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.ClientImpl#?:?] - The rocketmq client starts successfully, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   2023-11-17 11:09:20.606 INFO  [21493] [SimpleConsumerImpl-0 STARTING] [o.a.r.c.j.i.c.SimpleConsumerImpl#?:?] - The rocketmq simple consumer starts successfully, clientId=gzzdeMacBook-Air.local@21493@0@k9hnmpuge
   
   
   ### RocketMQ Version of the Client/Server
   
   5.0.5
   
   ### Run or Compiler Version
   
   1.8 or 17
   
   ### Describe the Bug
   
   连不上
   
   ### Steps to Reproduce
   
   连上上
   
   ### What Did You Expect to See?
   
   1
   
   ### What Did You See Instead?
   
   1
   
   ### Additional Context
   
   _No response_


-- 
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@rocketmq.apache.org.apache.org

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


Re: [I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #637: [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接
URL: https://github.com/apache/rocketmq-clients/issues/637


-- 
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@rocketmq.apache.org

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


Re: [I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #637:
URL: https://github.com/apache/rocketmq-clients/issues/637#issuecomment-1899427349

   This issue was closed because it has been inactive for 3 days since being marked as stale.


-- 
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@rocketmq.apache.org

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


Re: [I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #637:
URL: https://github.com/apache/rocketmq-clients/issues/637#issuecomment-1892901745

   This issue is stale because it has been open for 30 days with no activity. It will be closed in 3 days if no further activity occurs.


-- 
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@rocketmq.apache.org

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


Re: [I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

Posted by "aaron-ai (via GitHub)" <gi...@apache.org>.
aaron-ai commented on issue #637:
URL: https://github.com/apache/rocketmq-clients/issues/637#issuecomment-1823861124

   @DoubleJee It seems like the connection was not established yet, could you add breakpoints to trace the method call stack? which could be helpful to find out why the request is pending.


-- 
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@rocketmq.apache.org

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


Re: [I] [Bug] JDK1.8 连接就报错,换成JDK17不报错能连接 [rocketmq-clients]

Posted by "jikuanyu (via GitHub)" <gi...@apache.org>.
jikuanyu commented on issue #637:
URL: https://github.com/apache/rocketmq-clients/issues/637#issuecomment-1858815821

   cd F:\rocketclient\RocketDemoApp; "JAVA_HOME=E:\\Program Files\\Java\\jdk-11" M2_HOME=F:\\apache-maven-3.9.5-bin\\apache-maven-3.9.5 cmd /c "\"F:\\apache-maven-3.9.5-bin\\apache-maven-3.9.5\\bin\\mvn.cmd\" -Dexec.vmArgs= \"-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}\" \"-Dexec.executable=E:\\Program Files\\Java\\jdk-11\\bin\\java.exe\" -Dexec.mainClass=com.mycompany.rocketdemoapp.PushConsumerExample -Dexec.classpathScope=runtime -Dexec.appArgs= \"-Dmaven.ext.class.path=F:\\Program Files\\NetBeans-18\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 --no-transfer-progress process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec"
   Scanning for projects...
   
   --------------------< com.mycompany:RocketDemoApp >---------------------
   Building RocketDemoApp 1.0-SNAPSHOT
     from pom.xml
   --------------------------------[ jar ]---------------------------------
   
   --- resources:3.3.1:resources (default-resources) @ RocketDemoApp ---
   skip non existing resourceDirectory F:\rocketclient\RocketDemoApp\src\main\resources
   
   --- compiler:3.11.0:compile (default-compile) @ RocketDemoApp ---
   Nothing to compile - all classes are up to date
   
   --- exec:3.1.0:exec (default-cli) @ RocketDemoApp ---
   Exception in thread "main" java.lang.IllegalStateException: Expected the service PushConsumerImpl-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.consumer.PushConsumerBuilderImpl.build(PushConsumerBuilderImpl.java:128)
   	at com.mycompany.rocketdemoapp.PushConsumerExample.main(PushConsumerExample.java:56)
   Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.716722798s. [buffered_nanos=2718196200, waiting_for_connection]
   	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.consumer.PushConsumerImpl.startUp(PushConsumerImpl.java:161)
   	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.base/java.lang.Thread.run(Thread.java:834)
   Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.716722798s. [buffered_nanos=2718196200, waiting_for_connection]
   	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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   	... 1 more
   Command execution failed.
   org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
       at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
       at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
       at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1000)
       at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
       at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
       at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
       at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
       at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
       at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
       at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke (Method.java:566)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
   ------------------------------------------------------------------------
   BUILD FAILURE
   ------------------------------------------------------------------------
   Total time:  5.182 s
   Finished at: 2023-12-16T21:07:49+08:00
   ------------------------------------------------------------------------
   Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project RocketDemoApp: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
   
   To see the full stack trace of the errors, re-run Maven with the -e switch.
   Re-run Maven using the -X switch to enable full debug logging.
   
   For more information about the errors and possible solutions, please read the following articles:
   [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
   
   
   
   我也遇到同样的问题,就是https://rocketmq.apache.org/zh/docs/quickStart/01quickstart。弄不通
   
   pom.xml
   `<?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <groupId>com.mycompany</groupId>
       <artifactId>RocketDemoApp</artifactId>
       <version>1.0-SNAPSHOT</version>
       <packaging>jar</packaging>
       <properties>
           <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       </properties>
       <repositories>  
           <repository>  
               <id>alimaven</id>  
               <name>aliyun maven</name>  
               <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
               <releases>  
                   <enabled>true</enabled>  
               </releases>  
               <snapshots>  
                   <enabled>false</enabled>  
               </snapshots>  
           </repository>  
       </repositories>
       <dependencies>
           <dependency>
               <groupId>org.apache.rocketmq</groupId>
               <artifactId>rocketmq-client-java</artifactId>
               <version>5.0.5</version>
           </dependency>
           <dependency>
               <groupId>org.slf4j</groupId>
               <artifactId>slf4j-api</artifactId>
               <version>1.7.30</version>
               <type>jar</type>
           </dependency>
           <dependency> 
               <groupId>ch.qos.logback</groupId>
               <artifactId>logback-classic</artifactId>
               <version>1.2.9</version>
           </dependency>
             <dependency>
           <groupId>ch.qos.logback</groupId>
           <artifactId>logback-core</artifactId>
           <version>1.2.9</version>
       </dependency>
     
       <dependency>
           <groupId>ch.qos.logback</groupId>
           <artifactId>logback-access</artifactId>
           <version>1.2.9</version>
       </dependency>
   
       </dependencies>
       <build>
      
       </build>
      
   
   
   </project>`
   
   代码就是
   `/*
    * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
    * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
    */
   package com.mycompany.rocketdemoapp;
   import org.apache.rocketmq.client.apis.ClientConfiguration;
   import org.apache.rocketmq.client.apis.ClientConfigurationBuilder;
   import org.apache.rocketmq.client.apis.ClientException;
   import org.apache.rocketmq.client.apis.ClientServiceProvider;
   import org.apache.rocketmq.client.apis.message.Message;
   import org.apache.rocketmq.client.apis.producer.Producer;
   import org.apache.rocketmq.client.apis.producer.SendReceipt;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   /**
    *
    * @author Administrator
    */
   public class ProducerExample {
       private static final Logger logger = LoggerFactory.getLogger(ProducerExample.class);
   
       public static void main(String[] args) throws ClientException {
           // 接入点地址,需要设置成Proxy的地址和端口列表,一般是xxx:8081;xxx:8081。
           String endpoint = "192.168.1.20:8081";
           // 消息发送的目标Topic名称,需要提前创建。
           String topic = "TestTopic";
           ClientServiceProvider provider = ClientServiceProvider.loadService();
           ClientConfigurationBuilder builder = ClientConfiguration.newBuilder().setEndpoints(endpoint);
           ClientConfiguration configuration = builder.build();
           // 初始化Producer时需要设置通信配置以及预绑定的Topic。
           Producer producer = provider.newProducerBuilder()
               .setTopics(topic)
               .setClientConfiguration(configuration)
               .build();
           // 普通消息发送。
           Message message = provider.newMessageBuilder()
               .setTopic(topic)
               // 设置消息索引键,可根据关键字精确查找某条消息。
               .setKeys("messageKey")
               // 设置消息Tag,用于消费端根据指定Tag过滤消息。
               .setTag("messageTag")
               // 消息体。
               .setBody("messageBody".getBytes())
               .build();
           try {
               // 发送消息,需要关注发送结果,并捕获失败等异常。
               SendReceipt sendReceipt = producer.send(message);
               logger.info("Send message successfully, messageId={}", sendReceipt.getMessageId());
           } catch (ClientException e) {
               logger.error("Failed to send message", e);
           }
           // producer.close();
       }
   }
   `
   
   
   `/*
    * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
    * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
    */
   package com.mycompany.rocketdemoapp;
   import java.io.IOException;
   import java.util.Collections;
   import org.apache.rocketmq.client.apis.ClientConfiguration;
   import org.apache.rocketmq.client.apis.ClientException;
   import org.apache.rocketmq.client.apis.ClientServiceProvider;
   import org.apache.rocketmq.client.apis.consumer.ConsumeResult;
   import org.apache.rocketmq.client.apis.consumer.FilterExpression;
   import org.apache.rocketmq.client.apis.consumer.FilterExpressionType;
   import org.apache.rocketmq.client.apis.consumer.PushConsumer;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   /**
    *
    * @author Administrator
    */
   public class PushConsumerExample {
       
       private static final Logger logger = LoggerFactory.getLogger(PushConsumerExample.class);
   
       private PushConsumerExample() {
       }
   
       public static void main(String[] args) throws ClientException, IOException, InterruptedException {
           final ClientServiceProvider provider = ClientServiceProvider.loadService();
           // 接入点地址,需要设置成Proxy的地址和端口列表,一般是xxx:8081;xxx:8081。
           String endpoints = "192.168.1.20:8081";
           ClientConfiguration clientConfiguration = ClientConfiguration.newBuilder()
               .setEndpoints(endpoints)
               .build();
           // 订阅消息的过滤规则,表示订阅所有Tag的消息。
           String tag = "*";
           FilterExpression filterExpression = new FilterExpression(tag, FilterExpressionType.TAG);
           // 为消费者指定所属的消费者分组,Group需要提前创建。
           String consumerGroup = "YourConsumerGroup";
           // 指定需要订阅哪个目标Topic,Topic需要提前创建。
           String topic = "TestTopic";
           // 初始化PushConsumer,需要绑定消费者分组ConsumerGroup、通信参数以及订阅关系。
           PushConsumer pushConsumer = provider.newPushConsumerBuilder()
               .setClientConfiguration(clientConfiguration)
               // 设置消费者分组。
               .setConsumerGroup(consumerGroup)
               // 设置预绑定的订阅关系。
               .setSubscriptionExpressions(Collections.singletonMap(topic, filterExpression))
               // 设置消费监听器。
               .setMessageListener(messageView -> {
                   // 处理消息并返回消费结果。
                   logger.info("Consume message successfully, messageId={}", messageView.getMessageId());
                  // logger.info("{}",new byte[messageView.getBody().remaining()]); messageBody = new byte[byteBuffer.remaining()];
                   return ConsumeResult.SUCCESS;
               })
               .build();
           Thread.sleep(Long.MAX_VALUE);
           // 如果不需要再使用 PushConsumer,可关闭该实例。
           // pushConsumer.close();
       }
   }
   `
   
   就是连不上谁能有什么法呀?
   


-- 
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@rocketmq.apache.org

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