tufei1846 2022-02-16 17:25 采纳率: 33.3%
浏览 47
已结题

nacos过一段时间会读错配置文件

这个是我的bootstrap.yml文件配置

spring:
  profiles:
    active: @profile.name@
  cloud:
    nacos:
      config:
        # Nacos 认证用户
        username: @config.username@
        # Nacos 认证密码
        password: @config.password@
        # 命名空间 常用场景之一是不同环境的配置的区分隔离,例如开发测试环境和生产环境的资源(如配置、服务)隔离等
        namespace: @config.namespace@
        # 配置中心地址
        server-addr: @config.server-addr@
        # 配置对应的分组
        group: @config.group@
        # 配置文件后缀
        file-extension: yaml
    #    prefix: ''
        refresh-enabled: true
      discovery:
        namespace: @config.namespace@
        server-addr: @config.server-addr@
        watch:
          enabled: false
        username: @config.username@
        password: @config.password@

这个是报错文件

group[DEFAULT_GROUP]
2022-02-08 10:51:15.500 [main] INFO  com.alibaba.nacos.client.config.utils.JvmUtil:49 - isMultiInstance:false
2022-02-08 10:51:15.566 [main] INFO  o.s.c.b.c.PropertySourceBootstrapConfiguration:112 - Located property source: [BootstrapPropertySource {name='bootstrapProperties-test1-prod.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-test1.yaml(指定的配置文件),DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-test1,DEFAULT_GROUP'}]
2022-02-08 10:51:15.870 [main] INFO  com.shenyue.collectionpro.CollectionProApplication:655 - The following profiles are active: prod
2022-02-08 10:51:20.068 [main] INFO  o.springframework.cloud.context.scope.GenericScope:295 - BeanFactory id=1ff5477b-c33c-3eb5-83ee-fef1bf3e88e5
2022-02-08 10:51:22.824 [main] INFO  o.s.boot.web.embedded.tomcat.TomcatWebServer:108 - Tomcat initialized with port(s): 8082 (http)
2022-02-08 10:51:23.146 [main] INFO  org.apache.coyote.http11.Http11NioProtocol:173 - Initializing ProtocolHandler ["http-nio-8082"]
2022-02-08 10:51:23.147 [main] INFO  org.apache.catalina.core.StandardService:173 - Starting service [Tomcat]
2022-02-08 10:51:23.147 [main] INFO  org.apache.catalina.core.StandardEngine:173 - Starting Servlet engine: [Apache Tomcat/9.0.39]
2022-02-08 10:51:23.952 [main] INFO  o.a.c.c.C.[Tomcat].[localhost].[/collection-pro]:173 - Initializing Spring embedded WebApplicationContext
2022-02-08 10:51:23.952 [main] INFO  o.s.b.w.s.c.ServletWebServerApplicationContext:285 - Root WebApplicationContext: initialization completed in 7925 ms
2022-02-08 10:51:25.452 [main] WARN  com.netflix.config.sources.URLConfigurationSource:121 - No URLs will be polled as dynamic configuration sources.
2022-02-08 10:51:25.453 [main] INFO  com.netflix.config.sources.URLConfigurationSource:122 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-02-08 10:51:25.539 [main] WARN  com.netflix.config.sources.URLConfigurationSource:121 - No URLs will be polled as dynamic configuration sources.
2022-02-08 10:51:25.539 [main] INFO  com.netflix.config.sources.URLConfigurationSource:122 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-02-08 10:51:26.046 [main] INFO  o.s.scheduling.concurrent.ThreadPoolTaskExecutor:181 - Initializing ExecutorService 'applicationTaskExecutor'
2022-02-08 10:51:26.676 [main] INFO  o.s.scheduling.concurrent.ThreadPoolTaskScheduler:181 - Initializing ExecutorService 'taskScheduler'
2022-02-08 10:51:26.871 [main] INFO  org.apache.coyote.http11.Http11NioProtocol:173 - Starting ProtocolHandler ["http-nio-8082"]
2022-02-08 10:51:26.962 [main] INFO  o.s.boot.web.embedded.tomcat.TomcatWebServer:220 - Tomcat started on port(s): 8082 (http) with context path '/collection-pro'
2022-02-08 10:51:26.969 [main] WARN  com.shenyue.collectionpro.mdb.convert.DBConvert:1522022-02-08 10:51:26.980 [main] INFO  com.alibaba.nacos.client.naming:64 - initializer namespace from System Property :null
2022-02-08 10:51:26.982 [main] INFO  com.alibaba.nacos.client.naming:73 - initializer namespace from System Environment :null
2022-02-08 10:51:26.983 [main] INFO  com.alibaba.nacos.client.naming:83 - initializer namespace from System Property :null
2022-02-08 10:51:27.137 [main] INFO  com.alibaba.nacos.client.naming:81 - [BEAT] adding beat: BeatInfo{port=8082, ip='192.168.1.88', weight=1.0, serviceName='DEFAULT_GROUP@@lingbozhnaoyang', cluster='DEFAULT', metadata={preserved.register.source=SPRING_CLOUD}, scheduled=false, period=5000, stopped=false} to beat map.
2022-02-08 10:51:27.138 [main] INFO  com.alibaba.nacos.client.naming:223 - [REGISTER-SERVICE] material registering service DEFAULT_GROUP@@lingbozhnaoyang with instance: Instance{instanceId='null', ip='192.168.1.88', port=8082, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={preserved.register.source=SPRING_CLOUD}}
2022-02-08 10:51:27.149 [main] INFO  c.a.cloud.nacos.registry.NacosServiceRegistry:71 - nacos registry, DEFAULT_GROUP lingbozhnaoyang 192.168.1.88:8082 register finished
2022-02-08 10:51:27.248 [main] INFO  com.shenyue.collectionpro.CollectionProApplication:61 - Started CollectionProApplication in 30.075 seconds (JVM running for 58.115)
2022-02-08 10:51:27.257 [main] WARN  com.shenyue.collectionpro.CollectionProApplication:26  : 《配置文件名称:test2》 

 我是用windows注册成服务的下面是我指定配置的文件

<service>
  
  <!-- ID of the service. It should be unique across the Windows system-->
  <id>collection-pro</id>
  <!-- Display name of the service -->
  <name>注册的服务名</name>
  <!-- Service description -->
  <description>This service is a service created from a minimal configuration</description>
  
  <!-- Path to the executable, which should be started -->
  <executable>C:\java\jre1.8.0_191\bin\java</executable>
  
  <arguments>-Xmx1024m -Dfile.encoding=utf-8 -jar collection-pro.jar <!--
  MIT License

<service>
  <!-- ID of the service. It should be unique across the Windows system-->
  <id>collection-pro</id>
  <!-- Display name of the service -->
  <name>注册的服务名</name>
  <!-- Service description -->
  <description>This service is a service created from a minimal configuration</description>
  
  <!-- Path to the executable, which should be started -->
  <executable>C:\java\jre1.8.0_191\bin\java</executable>
  
  <arguments>-Xmx1024m -Dfile.encoding=utf-8 -jar collection-pro.jar --spring.application.name="心跳名称指定" --spring.cloud.nacos.config.prefix="指定的配置文件"</arguments>

</service>
"</arguments>

</service>

**各位同学请指教,如果需要补充欢迎评论。

万分感谢 **

  • 写回答

1条回答 默认 最新

  • 有问必答小助手 2022-02-18 09:59
    关注

    你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


    本次提问扣除的有问必答次数,已经为您补发到账户,我们后续会持续优化,扩大我们的服务范围,为您带来更好地服务。

    评论

报告相同问题?

问题事件

  • 系统已结题 2月24日
  • 创建了问题 2月16日

悬赏问题

  • ¥15 如何让子窗口鼠标滚动独立,不要传递消息给主窗口
  • ¥15 如何能达到用ping0.cc检测成这样?如图
  • ¥15 关于#DMA固件#的问题,请各位专家解答!
  • ¥15 matlab生成的x1图不趋于稳定,之后的图像是稳定的水平线
  • ¥15 请问华为OD岗位的内部职业发展通道都有哪些,以及各个级别晋升的要求
  • ¥20 微信小程序 canvas 问题
  • ¥15 系统 24h2 专业工作站版,浏览文件夹的图库,视频,图片之类的怎样删除?
  • ¥15 怎么把512还原为520格式
  • ¥15 MATLAB的动态模态分解出现错误,以CFX非定常模拟结果为快照
  • ¥15 求高通平台Softsim调试经验