- A+
一个很简单的nacos工程,虽然启动时报错,但可以正常注册到nacos注册中心,所以一开始没怎么管它,但是作为有强迫症的人来说怎么能接受有错呢。。
2019-07-12 14:14:32.125 ERROR 13252 --- [ main] o.s.c.a.n.registry.NacosServiceRegistry : nacos registry, gateway register failed...NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', endpoint='', namespace='', logName='', service='gateway', weight=1.0, clusterName='DEFAULT', metadata={}, registerEnabled=true, ip='192.168.129.1', networkInterface='', port=8073, secure=false, accessKey='', secretKey=''}},
java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([127.0.0.1:8848]) tried
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:339) ~[nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:272) ~[nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:171) ~[nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:161) ~[nacos-client-0.3.0.jar:na]
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:58) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:31) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:211) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.cloud.alibaba.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:75) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:110) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:74) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:262) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:358) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:124) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at com.zp.gateway.GatewayApplication.main(GatewayApplication.java:12) [classes/:na]
2019-07-12 14:14:32.136 INFO 13252 --- [ main] com.zp.gateway.GatewayApplication : Started GatewayApplication in 6.892 seconds (JVM running for 7.466)
于是今天抽时间研究了下,这个错误在网上基本上搜不到什么有用的信息,倒是网上有一篇帖子提醒我,不止控制台有log,启动时也往日志文件里写了log,于是在C:\Users\Administrator\logs\nacos路径下打开log文件才发现真正的错误信息是
01 2019-07-12 14:10:34.371 ERROR [main :c.a.n.c.naming] [] [] [NA] req api:/nacos/v1/ns/instance failed, server(127.0.0.1:8848
com.alibaba.nacos.api.exception.NacosException: null
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:308) [nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:331) [nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:272) [nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:171) [nacos-client-0.3.0.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:161) [nacos-client-0.3.0.jar:na]
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:58) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.alibaba.nacos.registry.NacosServiceRegistry.register(NacosServiceRegistry.java:31) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.register(AbstractAutoServiceRegistration.java:211) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.cloud.alibaba.nacos.registry.NacosAutoServiceRegistration.register(NacosAutoServiceRegistration.java:75) [spring-cloud-alibaba-nacos-discovery-0.2.0.RELEASE.jar:0.2.0.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.start(AbstractAutoServiceRegistration.java:110) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration.bind(AbstractAutoServiceRegistration.java:74) [spring-cloud-commons-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:262) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:358) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:124) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) [spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at com.zp.gateway.GatewayApplication.main(GatewayApplication.java:12) [classes/:na]
空指针异常,好吧,新出的框架就是问题多。。搜索这个异常时,github上有人说是版本问题。最终发现是spring-cloud-starter-alibaba-nacos-discovery这个的版本影响的,上述报错用的是0.2.0.RELEASE这个版本,换成0.2.1.RELEASE就好了。。
2021年7月9日 下午9:48 沙发
大家好,
我是一名运行漏洞识别服务的独立安全研究员,我无意中发现了您的基础设施中的一些漏洞。
它可能会对您的网站造成损害。我想与您分享漏洞详细信息(包括 POC、屏幕截图和建议的解决方案)。
那么告诉我我可以在这里报告吗?有效的报告/错误是否有任何感谢奖励?
请尽快回复:)
问候。