1、问题描述:
首次使用nacos服务注册中心,下载完成后,点击startup.cmd文件,默认为集群启动,但我们没有布置集群就等待后报错。
报错信息
ErrMsg:jmenv.tbsite.net
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instant
iate(ConstructorResolver.java:622)
... 63 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Err
or creating bean with name 'distroFilter': Unsatisfied dependency expressed thro
ugh field 'distroMapper'; nested exception is org.springframework.beans.factory.
UnsatisfiedDependencyException: Error creating bean with name 'distroMapper' def
ined in URL [jar:file:/E:/jingshengsiwei/LIMS/code/nacos-server-2.0.4/nacos/targ
et/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.4.jar!/com/alibaba/nacos/nami
ng/core/DistroMapper.class]: Unsatisfied dependency expressed through constructo
r parameter 0; nested exception is org.springframework.beans.factory.BeanCreatio
nException: Error creating bean with name 'serverMemberManager' defined in URL [
jar:file:/E:/jingshengsiwei/LIMS/code/nacos-server-2.0.4/nacos/target/nacos-serv
er.jar!/BOOT-INF/lib/nacos-core-2.0.4.jar!/com/alibaba/nacos/core/cluster/Server
MemberManager.class]: Bean instantiation via constructor failed; nested exceptio
n is org.springframework.beans.BeanInstantiationException: Failed to instantiate
[com.alibaba.nacos.core.cluster.ServerMemberManager]: Constructor threw excepti
on; nested exception is ErrCode:500, ErrMsg:jmenv.tbsite.net
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:598)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject
(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:376
)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1402)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:514)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$
doGetBean$0(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda
$142/1020923989.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:319)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:199)
at org.springframework.context.annotation.ConfigurationClassEnhancer$Bea
nMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:394)
at org.springframework.context.annotation.ConfigurationClassEnhancer$Bea
nMethodInterceptor.intercept(ConfigurationClassEnhancer.java:366)
at com.alibaba.nacos.naming.web.NamingConfig$$EnhancerBySpringCGLIB$$6ba
6dbd2.distroFilter(<generated>)
at com.alibaba.nacos.naming.web.NamingConfig.distroFilterRegistration(Na
mingConfig.java:42)
at com.alibaba.nacos.naming.web.NamingConfig$$EnhancerBySpringCGLIB$$6ba
6dbd2.CGLIB$distroFilterRegistration$0(<generated>)
at com.alibaba.nacos.naming.web.NamingConfig$$EnhancerBySpringCGLIB$$6ba
6dbd2$$FastClassBySpringCGLIB$$cb37c6b5.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.j
ava:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$Bea
nMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at com.alibaba.nacos.naming.web.NamingConfig$$EnhancerBySpringCGLIB$$6ba
6dbd2.distroFilterRegistration(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:154)
... 64 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Err
or creating bean with name 'distroMapper' defined in URL [jar:file:/E:/jingsheng
siwei/LIMS/code/nacos-server-2.0.4/nacos/target/nacos-server.jar!/BOOT-INF/lib/n
acos-naming-2.0.4.jar!/com/alibaba/nacos/naming/core/DistroMapper.class]: Unsati
sfied dependency expressed through constructor parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'serverMemberManager' defined in URL [jar:file:/E:/jingshengsiwei/LIMS/co
de/nacos-server-2.0.4/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-core-2.0
.4.jar!/com/alibaba/nacos/core/cluster/ServerMemberManager.class]: Bean instanti
ation via constructor failed; nested exception is org.springframework.beans.Bean
InstantiationException: Failed to instantiate [com.alibaba.nacos.core.cluster.Se
rverMemberManager]: Constructor threw exception; nested exception is ErrCode:500
, ErrMsg:jmenv.tbsite.net
at org.springframework.beans.factory.support.ConstructorResolver.createA
rgumentArray(ConstructorResolver.java:769)
at org.springframework.beans.factory.support.ConstructorResolver.autowir
eConstructor(ConstructorResolver.java:218)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:514)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$
doGetBean$0(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda
$142/1020923989.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:319)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolve
Candidate(DependencyDescriptor.java:277)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
doResolveDependency(DefaultListableBeanFactory.java:1276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
resolveDependency(DefaultListableBeanFactory.java:1196)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:595)
... 88 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'serverMemberManager' defined in URL [jar:file:/E:/jingshengsi
wei/LIMS/code/nacos-server-2.0.4/nacos/target/nacos-server.jar!/BOOT-INF/lib/nac
os-core-2.0.4.jar!/com/alibaba/nacos/core/cluster/ServerMemberManager.class]: Be
an instantiation via constructor failed; nested exception is org.springframework
.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.core
.cluster.ServerMemberManager]: Constructor threw exception; nested exception is
ErrCode:500, ErrMsg:jmenv.tbsite.net
at org.springframework.beans.factory.support.ConstructorResolver.instant
iate(ConstructorResolver.java:304)
at org.springframework.beans.factory.support.ConstructorResolver.autowir
eConstructor(ConstructorResolver.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:514)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$
doGetBean$0(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda
$142/1020923989.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:319)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolve
Candidate(DependencyDescriptor.java:277)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
doResolveDependency(DefaultListableBeanFactory.java:1276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
resolveDependency(DefaultListableBeanFactory.java:1196)
at org.springframework.beans.factory.support.ConstructorResolver.resolve
AutowiredArgument(ConstructorResolver.java:857)
at org.springframework.beans.factory.support.ConstructorResolver.createA
rgumentArray(ConstructorResolver.java:760)
... 102 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to insta
ntiate [com.alibaba.nacos.core.cluster.ServerMemberManager]: Constructor threw e
xception; nested exception is ErrCode:500, ErrMsg:jmenv.tbsite.net
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1
87)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.instant
iate(ConstructorResolver.java:300)
... 117 common frames omitted
Caused by: com.alibaba.nacos.api.exception.NacosException: java.net.UnknownHostE
xception: jmenv.tbsite.net
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.run(A
ddressServerMemberLookup.java:150)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.doSta
rt(AddressServerMemberLookup.java:98)
at com.alibaba.nacos.core.cluster.AbstractMemberLookup.start(AbstractMem
berLookup.java:53)
at com.alibaba.nacos.core.cluster.ServerMemberManager.initAndStartLookup
(ServerMemberManager.java:185)
at com.alibaba.nacos.core.cluster.ServerMemberManager.init(ServerMemberM
anager.java:165)
at com.alibaba.nacos.core.cluster.ServerMemberManager.<init>(ServerMembe
rManager.java:146)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1
75)
... 119 common frames omitted
Caused by: java.net.UnknownHostException: jmenv.tbsite.net
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:1167)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConn
ection.java:1103)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:997)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:931)
at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.exe
cute(JdkHttpClientRequest.java:114)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosR
estTemplate.java:482)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.get(NacosRestT
emplate.java:72)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.syncF
romAddressUrl(AddressServerMemberLookup.java:173)
at com.alibaba.nacos.core.cluster.lookup.AddressServerMemberLookup.run(A
ddressServerMemberLookup.java:141)
... 129 common frames omitted
2022-04-25 14:17:16,763 WARN [WatchFileCenter] start close
2022-04-25 14:17:16,764 WARN [WatchFileCenter] start to shutdown this watcher wh
ich is watch : E:\jingshengsiwei\LIMS\code\nacos-server-2.0.4\nacos\conf
2022-04-25 14:17:16,765 WARN [WatchFileCenter] already closed
2022-04-25 14:17:16,765 WARN [NotifyCenter] Start destroying Publisher
2022-04-25 14:17:16,766 WARN [NotifyCenter] Destruction of the end
2022-04-25 14:17:16,767 ERROR Nacos failed to start, please see E:\jingshengsiwe
i\LIMS\code\nacos-server-2.0.4\nacos\logs\nacos.log for more details.
2、解决方案
找到startup.cmd文件,文件路径:nacos\bin\startup.cmd,将 set MODE=“cluster” 修改为 set MODE=“standalone” 。意思就是nacos服务从集群模式修改为单机模式启动。