运行nacos时报错namingService unsubscribe failed

java.lang.RuntimeException: ErrCode:-400, ErrMsg:Could not initialize class com.alibaba.nacos.common.remote.client.grpc.GrpcSdkClient

at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:102)

at com.alibaba.cloud.nacos.NacosServiceManager.buildNamingService(NacosServiceManager.java:90)

at com.alibaba.cloud.nacos.NacosServiceManager.getNamingService(NacosServiceManager.java:46)

at com.alibaba.cloud.nacos.discovery.NacosWatch.stop(NacosWatch.java:173)

at com.alibaba.cloud.nacos.discovery.NacosWatch.destroy(NacosWatch.java:204)

at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:213)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:587)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:559)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1163)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1156)

at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1106)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:596)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)

at com.atguigu.gulimall.coupon.GulimallCouponApplication.main(GulimallCouponApplication.java:12)

Caused by: com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationTargetException

at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:61)

at com.alibaba.nacos.api.NacosFactory.createNamingService(NacosFactory.java:77)

at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:99)

... 19 common frames omitted

Caused by: java.lang.reflect.InvocationTargetException: null

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:59)

... 21 common frames omitted

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.nacos.common.remote.client.grpc.GrpcSdkClient

at com.alibaba.nacos.common.remote.client.RpcClientFactory.lambda$createClient$0(RpcClientFactory.java:81)

at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)

at com.alibaba.nacos.common.remote.client.RpcClientFactory.createClient(RpcClientFactory.java:79)

at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.<init>(NamingGrpcClientProxy.java:87)

at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.<init>(NamingClientProxyDelegate.java:76)

at com.alibaba.nacos.client.naming.NacosNamingService.init(NacosNamingService.java:95)

at com.alibaba.nacos.client.naming.NacosNamingService.<init>(NacosNamingService.java:81)

... 26 common frames omitted

最终在依赖中添加

<dependency>

<groupId>com.alibaba.nacos</groupId>

<artifactId>nacos-client</artifactId>

<version>2.0.4</version>

</dependency>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值