注册成功但是服务列表不显示服务

来源:4-3 Alibaba Nacos Client 服务注册与发现

慕运维3014355

2022-05-17

springcloud-alibaba-nacos-client昨天完成之后能成功注册能获取http状态。
今天完成nacos-admin之后发现nacos-client出现问题。
程序不报错,console也显示了registry,但是nacos上不显示服务。
cmd查询8000端口,也有listening状态

C:\Users\Hang>netstat -aon|findstr "8000"
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       20416
  TCP    [::]:8000              [::]:0                 LISTENING       20416
Connected to the target VM, address: '127.0.0.1:55531', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.1.RELEASE)

2022-05-17 12:11:37.808  INFO 20416 --- [           main] c.i.ecommerce.NacosClientApplication     : No active profile set, falling back to default profiles: default
2022-05-17 12:11:38.729  WARN 20416 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2022-05-17 12:11:38.858  INFO 20416 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=f69aed81-407b-3e84-bae6-86e4a867700a
2022-05-17 12:11:39.179  INFO 20416 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8000 (http)
2022-05-17 12:11:39.192  INFO 20416 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-05-17 12:11:39.192  INFO 20416 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.36]
2022-05-17 12:11:39.328  INFO 20416 --- [           main] o.a.c.c.C.[.[.[/ecommerce-nacos-client]  : Initializing Spring embedded WebApplicationContext
2022-05-17 12:11:39.329  INFO 20416 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1503 ms
2022-05-17 12:11:39.509  WARN 20416 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2022-05-17 12:11:39.509  INFO 20416 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-05-17 12:11:39.512  WARN 20416 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2022-05-17 12:11:39.512  INFO 20416 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-05-17 12:11:39.634  INFO 20416 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2022-05-17 12:11:39.983  INFO 20416 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'Nacos-Watch-Task-Scheduler'
2022-05-17 12:11:40.655  INFO 20416 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 18 endpoint(s) beneath base path '/actuator'
2022-05-17 12:11:40.873  INFO 20416 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8000 (http) with context path '/ecommerce-nacos-client'
2022-05-17 12:11:40.886  INFO 20416 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, DEFAULT_GROUP e-commerce-nacos-client 192.168.1.11:8000 register finished
2022-05-17 12:11:41.123  INFO 20416 --- [           main] c.i.ecommerce.NacosClientApplication     : Started NacosClientApplication in 4.578 seconds (JVM running for 6.4)
2022-05-17 12:11:41.655  INFO 20416 --- [3)-192.168.1.11] o.a.c.c.C.[.[.[/ecommerce-nacos-client]  : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-05-17 12:11:41.655  INFO 20416 --- [3)-192.168.1.11] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-05-17 12:11:41.663  INFO 20416 --- [3)-192.168.1.11] o.s.web.servlet.DispatcherServlet        : Completed initialization in 8 ms

写回答

1回答

张勤一

2022-05-17

同学你好:

    这种问题基本就是配置导致的问题,且只看这些日志的话,很难定位具体的问题出现在哪里。我个人建议先对比下我的工程配置,简单调整下;另外,可以每个微服务分开去注册,看看是哪个微服务引发的问题。

1
2
慕运维3014355
重启电脑解决了 看来不是代码的问题
2022-05-17
共2条回复

Spring Cloud / Alibaba 微服务架构实战

从架构设计到开发实践,手把手实现

1210 学习 · 674 问题

查看课程