当前位置: 首页 > 知识库问答 >
问题:

NoSuchLabelException:没有这样的标签Spring云服务器

韩恺
2023-03-14

我正在创建基本的spring云服务器,我有一个项目配置服务器:

application.properties

spring.application.name=zuulMicroservice
server.port=8888

spring.cloud.config.server.git.uri=file:///C:/Users/rober/git/microservices/config
#spring.cloud.config.server.git.uri=https://github.com/robertofdez97/microservices.git/config
#spring.profiles.active=native

主类

@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }

}

和另一个项目名称项:

application.properties

spring.application.name=itemsMicroservice
server.port=8002

eureka.client.service-url.defaultZone=http://localhost:8761/eureka

在路径文件:///C:/User/rober/git/microservices/config中,我有文件itemsMicroservice.properties包含:

server.port = 8005

在postman中,我有以下请求localhost:8888/itemsMicroservice/default,并获得以下消息

timestamp": "2021-01-06T21:10:54.075+00:00",
    "status": 404,
    "error": "Not Found",
    "trace": "org.springframework.cloud.config.server.environment.NoSuchLabelException: No such label: master\r\n\tat org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh(JGitEnvironmentRepository.java:289)\r\n\tat org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.getLocations(JGitEnvironmentRepository.java:246)\r\n\tat org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.getLocations(MultipleJGitEnvironmentRepository.java:146)\r\n\tat org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository.findOne(AbstractScmEnvironmentRepository.java:57)\r\n\tat org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:187)\r\n\tat org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne(CompositeEnvironmentRepository.java:67)\r\n\tat org.springframework.cloud.config.server.environment.EnvironmentEncryptorEnvironmentRepository.findOne(EnvironmentEncryptorEnvironmentRepository.java:61)\r\n\tat org.springframework.cloud.config.server.environment.EnvironmentController.getEnvironment(EnvironmentController.java:136)\r\n\tat org.springframework.cloud.config.server.environment.EnvironmentController.defaultLabel(EnvironmentController.java:108)\r\n\tat jdk.internal.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:564)\r\n\tat org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)\r\n\tat org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499)\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\r\n\tat org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)\r\n\tat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)\r\n\tat org.springframework.cloud.config.server.environment.EnvironmentController$$EnhancerBySpringCGLIB$$1eee6726.defaultLabel(<generated>)\r\n\tat jdk.internal.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:564)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)\r\n\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:626)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:733)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\r\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)\r\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\r\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)\r\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\r\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)\r\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)\r\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)\r\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\r\n\tat java.base/java.lang.Thread.run(Thread.java:832)\r\nCaused by: org.eclipse.jgit.api.errors.RefNotFoundException: Ref master cannot be resolved\r\n\tat org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:254)\r\n\tat org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.checkout(JGitEnvironmentRepository.java:416)\r\n\tat org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh(JGitEnvironmentRepository.java:282)\r\n\t... 70 more\r\n",
    "message": "No such label: master",
    "path": "/itemsMicroservice/default"

在git中,我有2个分支主节点和开发,但我的所有代码都在开发分支中。C:用户/rober/git/微服务是我的本地存储库,我创建了文件夹“config”,并创建了属性文件。后来当我播种它不起作用时,我使用文件夹中的命令“git init”

谢谢你的帮助,对不起,我的英语不是我的母语

共有1个答案

卫弘图
2023-03-14

如果您使用的是最新的git版本,它会将第一个分支名称创建为“main”,而不是以前版本中的“master”。检查此链接以更改分支名称

本质上,应该添加一个新属性来更改默认标签:

spring.cloud.config.server.git.default-label=main
 类似资料:
  • 我有一个简单的Spring云配置服务器,它使用git服务器的配置。 ConfigServer引导。yml: 当我在本地部署ConfigServer时,我可以从http://localhost:8888/myapp/test 。但当我在测试服务器上部署ConfigServer时,当我点击

  • 我用Spring Boot开发了一个微服务。此服务正在使用Spring云配置服务器获取属性。此微服务接受标头中的版本,并根据版本执行相应的功能。在我的github repo中,我有2个分支,每个版本1个。该服务通常将以下信息发送到配置服务器以获取属性- 应用程序名称配置文件标签 是否有办法在my中使用占位符代替标签。yml文件?如果我在标题else v2中看到v1,我希望将标签动态设置为v1。 编

  • 我正在尝试用铁轨在条纹中创建一个一次性的单次充电。我得到以下错误: 不过,从照片中可以清楚地看到,令牌在参数中。该令牌来自Stripe.js。 下面是我的控制器中的代码:

  • 我正在开发一个web应用程序,通过SMTP将邮件客户端连接到Amazon SES(并运行发送报告等),在这些邮件客户端中,我目前必须使用以下功能: email-smtp.us-east-1.amazonaws.com 作为服务器,有时还必须要求用户将其放入SMTP服务器设置中。我想知道我是否可以为我已经拥有的域名创建一个CNAME,比如ses,而不是使用那个长域名。实例com并将其指向电子邮件sm

  • 问题内容: 我正在使用Django-CMS的Django项目中构建一个相当简单的应用程序,即研究项目。(这是我对项目/应用程序的首次尝试。)它的主要目的是存储各种知识资产(例如,研究人员撰写的文章,书籍等)。 问题是,当我将浏览器指向/ research /时,出现一条错误,提示表’research_journal’不存在(“ no such table”)。 我正在使用带有sqlite3数据库的

  • 我有一个简单的spring boot应用程序,它从JMS队列中获取消息,并将一些数据保存到日志文件中,但不需要web服务器。有没有办法在没有web服务器的情况下启动spring boot?