Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native-image之后无法连接namesvr,但是在jdk环境里面可以连接 #633

Open
huyu-tom opened this issue Feb 26, 2024 · 0 comments
Open

Comments

@huyu-tom
Copy link

huyu-tom commented Feb 26, 2024

版本:
SpringBoot3.1.6版本 和 rocketmq-spring-boot-starter 2.2.3版本

Native-Image之后错误信息
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRegisterListener': java.lang.IllegalStateException: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to <192.168.192.214:8876> failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:605) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[ai:6.0.14]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[ai:6.0.14]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[ai:6.0.14]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[ai:6.0.14]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[ai:6.0.14]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[ai:3.1.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[ai:3.1.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[ai:3.1.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[ai:3.1.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[ai:3.1.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[ai:3.1.6]
at com.huyu.App.main(App.java:13) ~[ai:na]
at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to <192.168.192.214:8876> failed
at org.apache.rocketmq.spring.autoconfigure.ListenerContainerConfiguration.registerContainer(ListenerContainerConfiguration.java:109) ~[ai:na]
at org.apache.rocketmq.spring.annotation.RocketMQMessageListenerBeanPostProcessor.postProcessAfterInitialization(RocketMQMessageListenerBeanPostProcessor.java:55) ~[ai:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1773) ~[ai:6.0.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[ai:6.0.14]
... 16 common frames omitted
Caused by: java.lang.IllegalStateException: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to <192.168.192.214:8876> failed
at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:671) ~[ai:5.0.0]
at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:500) ~[ai:5.0.0]
at org.apache.rocketmq.client.impl.consumer.DefaultMQPushConsumerImpl.updateTopicSubscribeInfoWhenSubscriptionChanged(DefaultMQPushConsumerImpl.java:1206) ~[na:na]
at org.apache.rocketmq.client.impl.consumer.DefaultMQPushConsumerImpl.start(DefaultMQPushConsumerImpl.java:969) ~[na:na]
at org.apache.rocketmq.client.consumer.DefaultMQPushConsumer.start(DefaultMQPushConsumer.java:737) ~[na:na]
at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.start(DefaultRocketMQListenerContainer.java:343) ~[ai:2.2.3]
at org.apache.rocketmq.spring.autoconfigure.ListenerContainerConfiguration.registerContainer(ListenerContainerConfiguration.java:106) ~[ai:na]
... 20 common frames omitted
Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to <192.168.192.214:8876> failed
at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.invokeSyncImpl(NettyRemotingAbstract.java:436) ~[ai:5.0.0]
at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:455) ~[na:na]
at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1785) ~[na:na]
at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1776) ~[na:na]
at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:610) ~[ai:5.0.0]
... 26 common frames omitted

本地使用JDK:
a producer (ai-project) init on namesrv 192.168.192.214:8876
2024-02-26T22:52:24.294+08:00 INFO 25819 --- [ main] a.r.s.s.DefaultRocketMQListenerContainer : running container: DefaultRocketMQListenerContainer{consumerGroup='close-order-group', namespace='', nameServer='192.168.192.214:8876', topic='ORDER_CLOSE_TOPIC', consumeMode=CONCURRENTLY, selectorType=TAG, selectorExpression='', messageModel=CLUSTERING', tlsEnable=false, instanceName=DEFAULT}
2024-02-26T22:52:24.294+08:00 INFO 25819 --- [ main] o.a.r.s.a.ListenerContainerConfiguration : Register the listener to container, listenerBeanName:orderCloseListener, containerBeanName:org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1
2024-02-26T22:52:24.325+08:00 INFO 25819 --- [ main] a.r.s.s.DefaultRocketMQListenerContainer : running container: DefaultRocketMQListenerContainer{consumerGroup='user-register-group', namespace='', nameServer='192.168.192.214:8876', topic='USER_REGISTER_SUCCESS_TOPIC', consumeMode=CONCURRENTLY, selectorType=TAG, selectorExpression='
', messageModel=CLUSTERING', tlsEnable=false, instanceName=DEFAULT}
2024-02-26T22:52:24.325+08:00 INFO 25819 --- [ main] o.a.r.s.a.ListenerContainerConfiguration : Register the listener to container, listenerBeanName:userRegisterListener, containerBeanName:org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_2
就可以连接成功

配置如下
rocketmq:
producer:
group: ai-project
retry-next-server: true
send-message-timeout: 10
name-server: 192.168.192.214:8876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant