Spring Cloud Config无法从私有git存储库

时间:2015-09-22 17:39:42

标签: java eclipse spring spring-boot

我使用spring spring config server的类路径来放置所有配置文件,现在我决定将它移动到git服务器,所以我创建了一个空的存储库,然后提交了我的配置文件。

配置如下所示:

server:
  port: 8888

spring:
  application:
    name: server-config
  cloud:
    config:
      server:
        git:
          uri: ssh://development@xxx.xx.my.ip:/home/development/repository
          password: password

当我启动配置服务器时,一切正常,但是当我不想通过url访问微服务的配置时(例如:http://localhost:8888/get-ticket/env),我收到以下消息:

  

Whitelabel错误页面

     

这个应用程序没有/ error的显式映射,所以你看到了   这是一个后备。 Tue Sep 22 14:30:31 GMT-03:00 2015年有一个   意外错误(类型=内部服务器错误,状态= 500)。无法加载   环境

在我的堆栈跟踪中,我可以看到:

  

2015-09-22 14:30:31.024 INFO 9160 --- [nio-8888-exec-1]   o.s.web.servlet.DispatcherServlet:FrameworkServlet   ' dispatcherServlet':初始化完成于2015-09-22 18 ms   14:30:31.233 ERROR 9160 --- [nio-8888-exec-1]   o.a.c.c.C。[。[。[/]。[dispatcherServlet]:Servlet.service()for   在path []的上下文中的servlet [dispatcherServlet]引发了异常   [请求处理失败;嵌套异常是   java.lang.IllegalStateException:无法使用root加载环境]   原因

     

org.eclipse.jgit.errors.NotSupportedException:不支持URI:   ssh:///development@xxx.xx.my.ip:/ home / development / repository at   org.eclipse.jgit.transport.Transport.open(Transport.java:563)at   org.eclipse.jgit.transport.Transport.open(Transport.java:437)at   org.eclipse.jgit.transport.Transport.open(Transport.java:318)at   org.eclipse.jgit.transport.Transport.open(Transport.java:287)at   org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:120)at at   org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:178)at at   org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125)at   org.springframework.cloud.config.server.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:207)     在   org.springframework.cloud.config.server.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:180)     在   org.springframework.cloud.config.server.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:169)     在   org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:79)     在   org.springframework.cloud.config.server.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:84)     在   org.springframework.cloud.config.server.EnvironmentController.labelled(EnvironmentController.java:83)     在   org.springframework.cloud.config.server.EnvironmentController.defaultLabel(EnvironmentController.java:77)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)at   org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)     在   org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)     在   org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)     在   org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)     在   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)     在   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)     在   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)     在   org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:618)at   org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:725)at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration $ ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:291)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration $ MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:90)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)     在   org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)     在   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)     在   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)     在   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)     在   org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:659)     在   org.apache.coyote.http11.Http11NioProtocol $ Http11ConnectionHandler.process(Http11NioProtocol.java:223)     在   org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1558)     在   org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1515)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     在   org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)     在java.lang.Thread.run(Thread.java:745)

2 个答案:

答案 0 :(得分:0)

Spring配置在ssh连接上有问题,请使用http instread

答案 1 :(得分:0)

当尝试加载包含同步错误(例如重复密钥)的yml / properties文件时,Spring cloud config会给您500错误。

该错误消息没有为您提供有关问题原因的有用信息。有open issue可以改善错误消息。