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

集群模式bug,使用discovery会报错java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([172.XX.XX.23:80]) tried #1993

Closed
besthanliu opened this issue Oct 31, 2019 · 50 comments
Labels
area/Naming kind/user experience not necessarily an error but can be improved for user experience
Milestone

Comments

@besthanliu
Copy link

集群模式bug,使用discovery会报错java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([172.XX.XX.23:80]) tried
这个问题百度里也是大量反馈了
现在我用的全是最新的,还是有这个bug

@nkorange
Copy link
Collaborator

没有具体错误信息?客户端版本是什么?

@besthanliu
Copy link
Author

0.9.0.RELEASE Server是1.1.3.另外0.9.0是最新客户端了吧,还是大量甩出心跳日志,很烦,并不是你说的最新版本默认关闭的.
以下贴出集群模式报错代码,顺便贴出百度上一个这个例子的"解决"方案:https://www.cnblogs.com/forezp/p/10136433.html

报错:

<2019-11-01 09:42:47,414>[ERROR] request 120.79.76.96:8848 failed. - com.alibaba.nacos.client.naming
ErrCode:500,ErrMsg:failed to req API:http://120.79.76.96:8848/nacos/v1/ns/instance. code:500 msg: java.lang.NullPointerException
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:340)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:367)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:304)
at com.alibaba.nacos.client.naming.net.NamingProxy.deregisterService(NamingProxy.java:203)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:329)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:323)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:313)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.deregister(NacosServiceRegistry.java:87)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$FastClassBySpringCGLIB$$d01cc5c3.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$EnhancerBySpringCGLIB$$bfa41533.deregister()
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.deregister(AbstractAutoServiceRegistration.java:256)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.stop(AbstractAutoServiceRegistration.java:271)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.destroy(AbstractAutoServiceRegistration.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:156)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:242)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1040)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1033)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1026)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:975)
at org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar$SpringApplicationAdmin.shutdown(SpringApplicationAdminMXBeanRegistrar.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

@nkorange
Copy link
Collaborator

nkorange commented Nov 1, 2019

spring-cloud-alibaba最新版本依赖(nacos-client 1.1.1),不是nacos-client最新版本(nacos-client 1.1.4),你可以手动覆盖到nacos-client 1.1.4,如何覆盖请参考:https://nacos.io/zh-cn/docs/faq.html#3.15

另外我怀疑你依赖的不是0.9.0-RELEASE,nacos-client 1.1.1在NamingProxy 340行只是一个简单的map.put操作,不会出现空指针。你检查下以下依赖的版本是什么:

        <dependency>
            <groupId>com.alibaba.nacos</groupId>
            <artifactId>nacos-client</artifactId>
        </dependency>

@besthanliu
Copy link
Author

我知道了,我没有添加到最新的客户端版本,我 稍后尝试,集群模式这个问题怎么办.特别影响

@nkorange
Copy link
Collaborator

nkorange commented Nov 6, 2019

我知道了,我没有添加到最新的客户端版本,我 稍后尝试,集群模式这个问题怎么办.特别影响

请更新到最新版本客户端,再重试看看是否还有问题。

@besthanliu
Copy link
Author

有,现在ncos的spring-cloud-alibaba-dependencies和spring-cloud-starter-alibaba-nacos-*版本0.9.0-RELEASE,nacos-client 1.1.4,依然是这个问题,你们可以自己尝试下.server是部署在云服务器的,不是本地,然后采用集群模式,config没问题,discovery会报这个错误

@nkorange
Copy link
Collaborator

nkorange commented Nov 6, 2019

有,现在ncos的spring-cloud-alibaba-dependencies和spring-cloud-starter-alibaba-nacos-*版本0.9.0-RELEASE,nacos-client 1.1.4,依然是这个问题,你们可以自己尝试下.server是部署在云服务器的,不是本地,然后采用集群模式,config没问题,discovery会报这个错误

麻烦贴一下最新的报错,主要看错误堆栈

@besthanliu
Copy link
Author

基本上报错都是这些了:

<2019-11-07 10:34:00,641>[ERROR] [NA] failed to request - com.alibaba.nacos.client.naming
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.alibaba.nacos.client.naming.net.HttpClient.request(HttpClient.java:89)
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:413)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389)
at com.alibaba.nacos.client.naming.net.NamingProxy.deregisterService(NamingProxy.java:208)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:246)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:233)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:223)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.deregister(NacosServiceRegistry.java:87)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$FastClassBySpringCGLIB$$d01cc5c3.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$EnhancerBySpringCGLIB$$c53a079b.deregister()
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.deregister(AbstractAutoServiceRegistration.java:256)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.stop(AbstractAutoServiceRegistration.java:271)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.destroy(AbstractAutoServiceRegistration.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:156)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:242)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1040)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1033)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1026)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:975)
at org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar$SpringApplicationAdmin.shutdown(SpringApplicationAdminMXBeanRegistrar.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
<2019-11-07 10:34:00,643>[ERROR] request 119.23.26.172:8848 failed. - com.alibaba.nacos.client.naming
ErrCode:500, ErrMsg:failed to req API:119.23.26.172:8848/nacos/v1/ns/instance. code:500 msg: java.net.ConnectException: Connection refused: connect
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:427)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389)
at com.alibaba.nacos.client.naming.net.NamingProxy.deregisterService(NamingProxy.java:208)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:246)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:233)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:223)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.deregister(NacosServiceRegistry.java:87)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$FastClassBySpringCGLIB$$d01cc5c3.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$EnhancerBySpringCGLIB$$c53a079b.deregister()
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.deregister(AbstractAutoServiceRegistration.java:256)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.stop(AbstractAutoServiceRegistration.java:271)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.destroy(AbstractAutoServiceRegistration.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:156)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:242)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1040)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1033)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1026)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:975)
at org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar$SpringApplicationAdmin.shutdown(SpringApplicationAdminMXBeanRegistrar.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
<2019-11-07 10:34:00,673>[ERROR] request 120.79.76.96:8848 failed. - com.alibaba.nacos.client.naming
ErrCode:500, ErrMsg:failed to req API:120.79.76.96:8848/nacos/v1/ns/instance. code:500 msg: java.lang.NullPointerException
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:427)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389)
at com.alibaba.nacos.client.naming.net.NamingProxy.deregisterService(NamingProxy.java:208)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:246)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:233)
at com.alibaba.nacos.client.naming.NacosNamingService.deregisterInstance(NacosNamingService.java:223)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.deregister(NacosServiceRegistry.java:87)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$FastClassBySpringCGLIB$$d01cc5c3.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry$$EnhancerBySpringCGLIB$$c53a079b.deregister()
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.deregister(AbstractAutoServiceRegistration.java:256)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.stop(AbstractAutoServiceRegistration.java:271)
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.destroy(AbstractAutoServiceRegistration.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:156)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:242)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1040)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1033)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1026)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:975)
at org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar$SpringApplicationAdmin.shutdown(SpringApplicationAdminMXBeanRegistrar.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
<2019-11-07 10:34:00,675>[ERROR] ERR_NACOS_DEREGISTER, de-register failed...NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='120.79.76.96:8848,119.23.26.172:8848', endpoint='', namespace='', watchDelay=30000, logName='', service='nacos-provider', weight=1.0, clusterName='DEFAULT', namingLoadCacheAtStart='false', metadata={dubbo.metadata-service.urls=[ "dubbo://192.168.0.19:20880/org.springframework.cloud.alibaba.dubbo.service.DubboMetadataService?anyhost=true&application=nacos-provider&bind.ip=192.168.0.19&bind.port=20880&default.delay=-1&default.deprecated=false&default.dynamic=false&default.register=true&default.retries=0&default.timeout=60000&default.version=1.0.0&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=nacos-provider&interface=org.springframework.cloud.alibaba.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=13204&qos.enable=false&register=true&release=2.7.1&revision=0.9.0.RELEASE&side=provider&timestamp=1573094004341&version=1.0.0" ], dubbo.protocols.dubbo.port=20880, preserved.register.source=SPRING_CLOUD}, registerEnabled=true, ip='192.168.0.19', networkInterface='', port=9520, secure=false, accessKey='', secretKey=''}}, - org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry
java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([120.79.76.96:8848, 119.23.26.172:8848]) tried: failed to req API:120.79.76.96:8848/nacos/v1/ns/instance. code:500 msg: java.lang.NullPointerException
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:467)

@nkorange
Copy link
Collaborator

nkorange commented Nov 7, 2019

请看一下{user.home}/logs/naco/naming.log里的报错

@besthanliu
Copy link
Author

无此文件

@nkorange
Copy link
Collaborator

nkorange commented Nov 7, 2019

{user.home}/logs/nacos/naming.log 少打了个字母

@besthanliu
Copy link
Author

你说的可是服务端里面的日志?也没有,naming-distro.log,naming-event.log,naming-performance.log,naming-push.log,naming-server.log都有

@nkorange
Copy link
Collaborator

nkorange commented Nov 7, 2019

你说的可是服务端里面的日志?也没有,naming-distro.log,naming-event.log,naming-performance.log,naming-push.log,naming-server.log都有

客户端

@besthanliu
Copy link
Author

这边在windows和linux系统都跑了一遍,没有你说的这个目录/logs/nacos/和文件naming.log

@nkorange
Copy link
Collaborator

nkorange commented Nov 7, 2019

这边在windows和linux系统都跑了一遍,没有你说的这个目录/logs/nacos/和文件naming.log

{user.home}知道啥意思吧?

@besthanliu
Copy link
Author

besthanliu commented Nov 7, 2019 via email

@besthanliu
Copy link
Author

也是服务端的
image

@nkorange
Copy link
Collaborator

nkorange commented Nov 8, 2019

大概猜到是项目的根目录,我找不到,都跑去整个盘的根目录,linux的根目录,home,哪都找过了------------------ 原始邮件 ------------------ 发件人: "Fury Zhu"[email protected] 发送时间: 2019年11月7日(星期四) 晚上6:54 收件人: "alibaba/nacos"[email protected]; 抄送: "besthanliu"[email protected];"Author"[email protected]; 主题: Re: [alibaba/nacos] 集群模式bug,使用discovery会报错java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([172.XX.XX.23:80]) tried (#1993) 这边在windows和linux系统都跑了一遍,没有你说的这个目录/logs/nacos/和文件naming.log {user.home}知道啥意思吧? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

{user.home}是用户根目录

@besthanliu
Copy link
Author

如上图,整个盘都搜索过了,没有的,/usr/local/nacos,放的是nacos-server

@nkorange
Copy link
Collaborator

nkorange commented Nov 8, 2019

如上图,整个盘都搜索过了,没有的,/usr/local/nacos,放的是nacos-server

你客户端和nacos-server跑在一个机器上?

@besthanliu
Copy link
Author

@nkorange
Copy link
Collaborator

nkorange commented Nov 8, 2019

那就在nacos-server的日志里搜一下NullPointerException

@wangpin1997
Copy link

我看了你们的聊天,我也是这个问题,然后我查看了你说的对应位置的的文件,内容如下

2019-11-08 10:44:16.725 INFO [com.alibaba.nacos.naming.beat.sender:c.a.n.c.naming] [BEAT] 0abd1eef-7bdb-433d-967f-3c499a61998f sending beat to server: {"cluster":"DEFAULT","ip":"192.168.30.1","metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":8881,"scheduled":true,"serviceName":"DEFAULT_GROUP@@sale","weight":1.0}
2019-11-08 10:44:16.729 ERROR [com.alibaba.nacos.naming.beat.sender:c.a.n.c.naming] request 116.62.216.187:80 failed.
com.alibaba.nacos.api.exception.NacosException: failed to req API:116.62.216.187:80/nacos/v1/ns/instance/beat. code:503 msg: server is STARTING now, please try again later!
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:427) [nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454) [nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) [nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_201]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]

@wangpin1997
Copy link

然后我通过断点调试之后,我发现,程序里边拿到的namespace是系统默认生成的,不是我集群后数据库的那个,我不知道问题是不是出在这,希望能帮忙解决一下,方法调用,到这个init()方法这里就没有发现其他地方调用了
image
image
image

@nkorange
Copy link
Collaborator

nkorange commented Nov 8, 2019

image

@wangpin1997 你的是另外一个问题,你需要看一下Raft集群是否选举成功,可以看下控制台上 集群管理->节点列表。

@besthanliu
Copy link
Author

这个文件里面有
naming-server.log

@nkorange
Copy link
Collaborator

nkorange commented Nov 8, 2019

这个文件里面有
naming-server.log

你这个有NullPointer异常的机器,应该是cluster.conf配置有问题,执行下面的url看看和其他Nacos Server返回的是否一样:

curl '127.0.0.1:8848/nacos/v1/ns/operator/servers?healthy=true'

@besthanliu
Copy link
Author

确实有一台机器没开,这个会影响到整个集群吗,我尝试下开了看看

@besthanliu
Copy link
Author

现在两台机器都有开,还是一样.都能正常登录,还是一样,说不在服务列表
image
naming-server.log

@besthanliu
Copy link
Author

image

@besthanliu
Copy link
Author

naming-server.log

@besthanliu
Copy link
Author

QQ图片20191109161452

@besthanliu
Copy link
Author

666
同时发现,启动集群模式成功,无法发现其他节点,集群 模式我之前在同一台机器不同端口上试过是可以的.
另外回到主题的问题上,即便挂了一台,我感觉也不至于让客户端不能连上直接报错的啊

@nkorange
Copy link
Collaborator

nkorange commented Nov 9, 2019

666
同时发现,启动集群模式成功,无法发现其他节点,集群 模式我之前在同一台机器不同端口上试过是可以的.

你本机IP172.18.137.185不在cluster.conf里,需要加到里面去。

另外回到主题的问题上,即便挂了一台,我感觉也不至于让客户端不能连上直接报错的啊

这个是可以优化一下,目前心跳是一个同步请求,可以改成异步请求。暂定1.2.0优化

@nkorange nkorange added area/Naming kind/user experience not necessarily an error but can be improved for user experience labels Nov 9, 2019
@nkorange nkorange added this to the 1.2.0 milestone Nov 9, 2019
@besthanliu
Copy link
Author

关于:你本机IP172.18.137.185不在cluster.conf里,需要加到里面去。

这个问题解决了,其实算是一个bug.如上图我配的全是外网ip,nacos会自己找它们内网ip,关键这样一来,回到配置里,自然不存在172.18.137.185这个ip.

我百度了一下,人家是这么说的.
https://www.wandouip.com/t5i278697/
外网那个不灵活我就没用了,全部用回内网 ip.

最后全部节点启动完成之后,主题的问题也不存在了,可以正常使用.这边问一下,集群情况下都会这样吗?如果存在十来个节点,不会挂了一个就整个集群客户端异常吧,那不太好

@besthanliu
Copy link
Author

最后,非常感谢你的耐心回答,祝nacos项目越来越强

@cece18713537738
Copy link

cece18713537738 commented May 28, 2020

com.alibaba.nacos.api.exception.NacosException: failed to req API:http://59.110.54.188:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net.SocketTimeoutException: connect timed out
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:340) [nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:367) [nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:304) [nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:227) [nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:109) [nacos-client-1.0.0.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_162]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na:1.8.0_162]
at java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

2020-05-28 23:43:33.310 ERROR [cloud-auth,,,] 15564 --- [ing.beat.sender] com.alibaba.nacos.client.naming : [CLIENT-BEAT] failed to send beat: {"cluster":"DEFAULT","ip":"192.168.2.103","metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9777,"scheduled":true,"serviceName":"DEFAULT_GROUP@@cloud-auth","weight":1.0}

java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance/beat after all servers([59.110.54.188:8848]) tried: failed to req API:http://59.110.54.188:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net.SocketTimeoutException: connect timed out
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:380) ~[nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:304) ~[nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:227) ~[nacos-client-1.0.0.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:109) [nacos-client-1.0.0.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_162]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na:1.8.0_162]
at java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

我这里也有这个问题,nacos-server:1.0.1

单个nacos,非集群

@lijialin-code
Copy link

我的是1.1.4的NACOS集群 也是这个状况,有解决的办法吗,报错如下

[:] -- 2020-07-08 10:38:46.254 -- [requestId:] -- ERROR com.alibaba.nacos.client.naming.net.NamingProxy 457 reqAPI -- request nacos-service:8848
failed. com.alibaba.nacos.api.exception.NacosException: failed to req API:nacos-service:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net.So
cketTimeoutException: connect timed out: nacos-service:8848
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:427) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

[:] -- 2020-07-08 10:38:46.254 -- [requestId:] -- ERROR com.alibaba.nacos.client.naming.net.NamingProxy 319 sendBeat -- [CLIENT-BEAT] failed to s
end beat: {"cluster":"DEFAULT","ip":"10.42.1.238","metadata":{"preserved.register.source":"SPRING_CLOUD"},"period":5000,"port":9000,"scheduled":f
alse,"serviceName":"DEFAULT_GROUP@@cfyy-gateway","stopped":false,"weight":1.0} java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/in
stance/beat after all servers([nacos-service:8848]) tried: failed to req API:nacos-service:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net
.SocketTimeoutException: connect timed out: nacos-service:8848
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:467) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

[:] -- 2020-07-08 10:39:49.297 -- [requestId:] -- ERROR com.alibaba.nacos.client.naming.net.HttpClient 103 request -- [NA] failed to request java
.net.SocketTimeoutException: connect timed out: nacos-service:8848
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[?:?]
at java.net.Socket.connect(Socket.java:591) ~[?:?]
at sun.net.NetworkClient.doConnect(NetworkClient.java:177) ~[?:?]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:474) ~[?:?]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:569) ~[?:?]
at sun.net.www.http.HttpClient.(HttpClient.java:242) ~[?:?]
at sun.net.www.http.HttpClient.New(HttpClient.java:341) ~[?:?]
at sun.net.www.http.HttpClient.New(HttpClient.java:362) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1242) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1075) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1009) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1356) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1331) ~[?:?]
at com.alibaba.nacos.client.naming.net.HttpClient.request(HttpClient.java:85) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:413) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

[:] -- 2020-07-08 10:39:49.298 -- [requestId:] -- ERROR com.alibaba.nacos.client.naming.net.NamingProxy 457 reqAPI -- request nacos-service:8848 failed. com.alibaba.nacos.api.exception.NacosException: failed to req API:nacos-service:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net.SocketTimeoutException: connect timed out: nacos-service:8848
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:427) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:454) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

[:] -- 2020-07-08 10:39:49.298 -- [requestId:] -- ERROR com.alibaba.nacos.client.naming.net.NamingProxy 319 sendBeat -- [CLIENT-BEAT] failed to send beat: {"cluster":"DEFAULT","ip":"10.42.1.238","metadata":{"preserved.register.source":"SPRING_CLOUD"},"period":5000,"port":9000,"scheduled":false,"serviceName":"DEFAULT_GROUP@@cfyy-gateway","stopped":false,"weight":1.0} java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance/beat after all servers([nacos-service:8848]) tried: failed to req API:nacos-service:8848/nacos/v1/ns/instance/beat. code:500 msg: java.net.SocketTimeoutException: connect timed out: nacos-service:8848
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:467) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) ~[nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:312) [nacos-client-1.1.4.jar:?]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:98) [nacos-client-1.1.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

@jiyilee
Copy link

jiyilee commented Aug 25, 2020

悲催发现一样的问题,那几个自动生成的ip名称报错导致,而自动添加是因为不注意在其他配置中copy多了个label。。。
1598349672406
1598349679819

@NPFDamon
Copy link

naming.log
我的也是这个问题,上面是{user.home}/logs/naco/naming.log日志 nacos版本是1.3.2

@doubleReal
Copy link

你好,我的是用docker搭建的nacos集群配和docker下的nginx做的,nginx端口是1111,报如下的错误能问下要怎么解决吗

java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([192.168.3.29:1111]) tried: failed to req API:192.168.3.29:1111/nacos/v1/ns/instance. code:500 msg: java.net.SocketTimeoutException: Read timed out
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:464) ~[nacos-client-1.1.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:386) ~[nacos-client-1.1.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:188) ~[nacos-client-1.1.1.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:205) ~[nacos-client-1.1.1.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:184) ~[nacos-client-1.1.1.jar:na]
at com.alibaba.cloud.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:61) ~[spring-cloud-alibaba-nacos-discovery-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:239) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:74) [spring-cloud-alibaba-nacos-discovery-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:138) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:101) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:88) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:47) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:165) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) [spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at com.doublez.springcloud.PaymentMain9002.main(PaymentMain9002.java:16) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_231]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_231]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_231]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_231]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.2.RELEASE.jar:2.2.2.RELEASE]

2020-09-22 13:11:05.126 INFO 24064 --- [ restartedMain] com.doublez.springcloud.PaymentMain9002 : Started PaymentMain9002 in 11.418 seconds (JVM running for 12.175)
2020-09-22 13:11:05.745 INFO 24064 --- [(4)-192.168.3.5] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-09-22 13:11:05.745 INFO 24064 --- [(4)-192.168.3.5] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-09-22 13:11:05.749 INFO 24064 --- [(4)-192.168.3.5] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms

@dogs1024
Copy link

也是碰到相同的问题。把discovery版本改成2.2.3.RELEASE解决的。

com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-discovery
2.2.3.RELEASE

@cheungjingyu
Copy link

问题解决了吗,我也碰到了同样的问题,项目启动的时候注册成功了。

@cheungjingyu
Copy link

但是之后就开始报这个错误

@zhangfangfei
Copy link

zhangfangfei commented Dec 28, 2021

com.alibaba.nacos.api.exception.NacosException:未能REQ API:http://59.110.54.188:8848/nacos/v1/ns/instance/beat。代码:500 msg:java.net.SocketTimeoutException: 在 com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:340) [nacos-client-1.0.0.jar:na]连接超时 在 com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:367) [nacos-client-1.0.0.jar:na] 在 com.alibaba.nacos.client.naming.net.NamingProxy .reqAPI(NamingProxy.java:304) [nacos-client-1.0.0.jar:na] 在 com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:227) [nacos-client- 1.0.0.jar:na] 在 com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:109) [nacos-client-1.0.0.jar:na] 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_162] 在 java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na: 1.8.0_162] 在 java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na: 1.8.0_162] .0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_162] 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1148) [na: 1.8.0_162] .0_162] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162] 在 java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

2020-05-28 23:43:33.310 错误 [cloud-auth,,,] 15564 --- [ing.beat.sender] com.alibaba.nacos.client.naming:[CLIENT-BEAT] 未能发送节拍: {"cluster":"DEFAULT","ip":"192.168.2.103","metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":9777,"scheduled":true," serviceName":"DEFAULT_GROUP@@cloud-auth","weight":1.0}

java.lang.IllegalStateException:未能REQ API:/ NACOS / V1 / NS /实例/所有服务器后拍([59.110.54.188:8848])尝试:未能REQ API:http://59.110.54.188:8848/ nacos/v1/ns/instance/beat。代码:500 msg:java.net.SocketTimeoutException: 在 com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:380) ~[nacos-client-1.0.0.jar:na 时连接超时] 在 com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:304) ~[nacos-client-1.0.0.jar:na] 在 com.alibaba.nacos.client.naming.net .NamingProxy.sendBeat(NamingProxy.java:227) ~[nacos-client-1.0.0.jar:na] 在 com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:109) [nacos-client-1.0.0.jar:na] 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_162] 在 java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [na: 1.8.0_162] 在 java.util.concurrent.FutureTask.run(FutureTask.java) [na:1.8.0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na: 1.8.0_162] .0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_162] 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1148) [na: 1.8.0_162] .0_162] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162] 在 java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

我这里也有这个问题,nacos-server:1.0.1

有nacos,非集群

解决了吗???
非集群这个错误怎么解决呢

@zhangfangfei
Copy link

zhangfangfei commented Dec 28, 2021

java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/service/list after all servers([127.0.0.1:8838]) tried: failed to req API:127.0.0.1:8838/nacos/v1/ns/service/list. code:500 msg: java.net.ConnectException: Connection refused: connect
报拒绝链接,那我在哪里加链接哦

naming-server.log里也没报错

2021-12-28 15:24:44,911 WARN naming.distro config will be removed, please use core.protocol.distro replace.

2021-12-28 15:24:44,911 WARN Using naming.distro config to replace core.distro config

2021-12-28 15:24:45,032 INFO open empty service auto clean job, initialDelay : 50000 ms, period : 30000 ms

2021-12-28 15:24:45,034 INFO listen for service meta change

2021-12-28 15:24:45,043 INFO upgrade.state file is not exist

2021-12-28 15:24:48,046 INFO Load instance extension handler []

2021-12-28 15:24:48,064 INFO [SelectorManager] Load SelectorContextBuilder(class com.alibaba.nacos.naming.selector.context.CmdbSelectorContextBuilder) contextType(CMDB) successfully.

2021-12-28 15:24:48,064 INFO [SelectorManager] Load SelectorContextBuilder(class com.alibaba.nacos.naming.selector.context.NoneSelectorContextBuilder) contextType(NONE) successfully.

2021-12-28 15:24:48,064 INFO [SelectorManager] Load Selector(class com.alibaba.nacos.naming.selector.LabelSelector) type(label) contextType(CMDB) successfully.

2021-12-28 15:24:48,064 INFO [SelectorManager] Load Selector(class com.alibaba.nacos.naming.selector.NoneSelector) type(none) contextType(NONE) successfully.

@1228181394
Copy link

客户端访问正常的,服务端访问的nginx80端口的时候报500
java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([localhost:80]) tried: failed to req API:localhost:80/nacos/v1/ns/instance. code:500 msg: java.net.SocketTimeoutException: Read timed out
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:467) ~[nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:389) ~[nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:191) ~[nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:207) ~[nacos-client-1.1.4.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:186) ~[nacos-client-1.1.4.jar:na]
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:63) ~[spring-cloud-alibaba-nacos-discovery-0.9.0.RELEASE.jar:0.9.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:239) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.alibaba.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:74) [spring-cloud-alibaba-nacos-discovery-0.9.0.RELEASE.jar:0.9.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:138) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:101) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:88) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.onApplicationEvent(AbstractAutoServiceRegistration.java:47) [spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:165) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) [spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at com.kuang.springcloud.NacosConsumer_9000.main(NacosConsumer_9000.java:20) [classes/:na]

@1228181394
Copy link

naming-server.log报错

2022-03-28 15:03:14,988 WARN Exception while request: http://127.0.0.1:8845/nacos/v1/ns/operator/cluster/state, caused: {}

java.net.SocketException: Permission denied: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:83)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
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:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at com.alibaba.nacos.naming.misc.HttpClient.request(HttpClient.java:166)
at com.alibaba.nacos.naming.misc.HttpClient.httpGet(HttpClient.java:126)
at com.alibaba.nacos.naming.misc.NamingProxy.reqCommon(NamingProxy.java:293)
at com.alibaba.nacos.naming.cluster.ServerListManager$ServerInfoUpdater.run(ServerListManager.java:171)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
2022-03-28 15:03:14,988 WARN NamingProxy

java.io.IOException: failed to req API:http://127.0.0.1:8845/nacos/v1/ns/operator/cluster/state. code:500 msg: java.net.SocketException: Permission denied: connect
at com.alibaba.nacos.naming.misc.NamingProxy.reqCommon(NamingProxy.java:306)
at com.alibaba.nacos.naming.cluster.ServerListManager$ServerInfoUpdater.run(ServerListManager.java:171)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
2022-03-28 15:03:15,414 INFO receive config info: unknown#192.168.6.75:8845#1648450995412#4

@XiaooooooBawang
Copy link

是ip地址问题,nacos在集群模式下会自动在nacos/conf/cluster.conf中加入本实例的ip地址和端口,如果我们自己想在cluster.conf中配集群ip的话,会和自动加入的ip冲突。
image
所以不要自己配,把所有所有自动加入的ip放到各个nacos实例的cluster.conf中就行了
image

@1228181394
Copy link

建议优化一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Naming kind/user experience not necessarily an error but can be improved for user experience
Projects
None yet
Development

No branches or pull requests