spring-cloud-alibaba icon indicating copy to clipboard operation
spring-cloud-alibaba copied to clipboard

Could not initialize class com.alibaba.nacos.common.notify.NotifyCenter

Open yangjiahao996 opened this issue 2 years ago • 4 comments

java.lang.RuntimeException: ErrCode:-400, ErrMsg:Could not initialize class com.alibaba.nacos.common.notify.NotifyCenter## at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:102) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## at com.alibaba.cloud.nacos.NacosServiceManager.buildNamingService(NacosServiceManager.java:90) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## at com.alibaba.cloud.nacos.NacosServiceManager.getNamingService(NacosServiceManager.java:46) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## at com.alibaba.cloud.nacos.discovery.NacosWatch.stop(NacosWatch.java:173) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## at com.alibaba.cloud.nacos.discovery.NacosWatch.destroy(NacosWatch.java:204) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:213) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:587) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:559) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1163) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1156) ~[spring-beans-5.3.23.jar!/:5.3.23]## at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1106) ~[spring-context-5.3.23.jar!/:5.3.23]## at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:596) ~[spring-context-5.3.23.jar!/:5.3.23]## at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.4.jar!/:2.7.4]## at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.4.jar!/:2.7.4]## at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.4.jar!/:2.7.4]## at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.4.jar!/:2.7.4]## at com.atta.b2b.userweb.UserWebApplication.main(UserWebApplication.java:78) ~[classes!/:BEI_RELEASE_PLAN_FUND_V20231212131435_667750001.ecf19e1]## at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_301]## at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_301]## at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_301]## at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_301]## at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app.jar:BEI_RELEASE_PLAN_FUND_V20231212131435_667750001.ecf19e1]## at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[app.jar:BEI_RELEASE_PLAN_FUND_V20231212131435_667750001.ecf19e1]## at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app.jar:BEI_RELEASE_PLAN_FUND_V20231212131435_667750001.ecf19e1]## at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[app.jar:BEI_RELEASE_PLAN_FUND_V20231212131435_667750001.ecf19e1]##Caused by: com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationTargetException## at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:61) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.nacos.api.NacosFactory.createNamingService(NacosFactory.java:77) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:99) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## ... 25 more##Caused by: java.lang.reflect.InvocationTargetException## at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_301]## at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_301]## at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_301]## at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_301]## at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:59) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.nacos.api.NacosFactory.createNamingService(NacosFactory.java:77) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:99) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## ... 25 more##Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.nacos.common.notify.NotifyCenter## at com.alibaba.nacos.client.naming.NacosNamingService.init(NacosNamingService.java:92) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.nacos.client.naming.NacosNamingService.(NacosNamingService.java:81) ~[nacos-client-2.0.4.jar!/:?]## at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_301]## at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_301]## at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_301]## at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_301]## at com.alibaba.nacos.api.naming.NamingFactory.createNamingService(NamingFactory.java:59) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.nacos.api.NacosFactory.createNamingService(NacosFactory.java:77) ~[nacos-client-2.0.4.jar!/:?]## at com.alibaba.cloud.nacos.NacosServiceManager.createNewNamingService(NacosServiceManager.java:99) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]

yangjiahao996 avatar Dec 13 '23 09:12 yangjiahao996

请提供版本信息或者一个复现问题的 demo 示例,方便社区维护者定位和解决问题。

yuluo-yx avatar Dec 13 '23 14:12 yuluo-yx

springcloud alibaba version 2021.0.4.0 nacos version 2.0.4 springboot version 2.7.4

yangjiahao996 avatar Dec 14 '23 01:12 yangjiahao996

@yangjiahao996 According the stacktrace, mostly likely you are missing some dependencies in your project. So you need to find out which class is missing first.

starter-alibaba-nacos-discovery-2021.0.4.0.jar!/:2021.0.4.0]## ... 25 more##Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.nacos.common.notify.NotifyCenter## at com.alibaba.nacos.client.naming.NacosNamingService.init(NacosNamingService.java:92) ~[nacos-client-2.0.4.jar!/:?]## at

chickenlj avatar Jan 04 '24 08:01 chickenlj

This issue has been open 30 days with no activity. This will be closed in 7 days.

github-actions[bot] avatar Feb 03 '24 18:02 github-actions[bot]

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.

github-actions[bot] avatar Feb 23 '24 18:02 github-actions[bot]