A arrayindexoutofboundsexception problem was encountered while learning Spring Cloud config .
Learning Reference 70037291, the demo in this blog post uses the CAMDEN.SR6 version.
I used the FINCHLEY.RC2 version when I built the project, the other configurations are the same, but each access profile will be reported arrayindexoutofboundsexception, as follows:
2018-06-11 11:34:22.996 INFO 6784---[nio-8888-exec-2] o.a.c.c.c.[tomcat]. [localhost]. [/]: Initializing Spring frameworkservlet ' dispatcherservlet ' 2018-06-11 11:34:22.996 INFO 6784---[nio-8888-exec- 2] o.s.web.servlet.dispatcherservlet:frameworkservlet ' Dispatcherservlet ': Initialization started2018-06-11 11:34:23.015 INFO 6784---[nio-8888-exec-2] o.s.web.servlet.dispatcherservlet:frameworkservlet ' disp Atcherservlet ': Initialization completed in 19Ms2018-06-11 11:34:24.192 ERROR 6784---[nio-8888-exec-2] o.a.c.c.c.[.[. [/]. [Dispatcherservlet]: Servlet.service () forservlet [Dispatcherservlet] in the context with path [] threw exception [Request processing failed; nested exception is J Ava.lang.IllegalStateException:Cannot load environment] with root causejava.lang.StringIndexOutOfBoundsException: String index out of range:-1At java.lang.String.substring (String.java:1967) ~[na:1.8. 0_144] At Org.springframework.cloud.config.server.environment.HttpClientConfigurableHttpConnectionFactory.lookupHttpClientBuilder (Httpclientconfigurablehttpconnectionfactory.java:) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.HttpClientConfigurableHttpConnectionFactory.create ( Httpclientconfigurablehttpconnectionfactory.java:~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at Org.eclipse.jgit.transport.TransportHttp.httpOpen (Transporthttp.java:830) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.transport.TransportHttp.connect (Transporthttp.java:491) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.transport.TransportHttp.openFetch (Transporthttp.java:345) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at ORG.ECLIPSE.JGIT.TRANSPORT.FETCHPROCESS.EXECUTEIMP (Fetchprocess.java:137) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.transport.FetchProcess.execute (Fetchprocess.java:123) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.transport.Transport.fetch (Transport.java:1269) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.api.FetchCommand.call (Fetchcommand.java:241) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.api.CloneCommand.fetch (Clonecommand.java:306) ~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-R] at Org.eclipse.jgit.api.CloneCommand.call (Clonecommand.java:~[org.eclipse.jgit-4.11.0.201803080745-r.jar:4.11.0.201803080745-)R] at Org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir ( Jgitenvironmentrepository.java:560) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.copyRepository ( Jgitenvironmentrepository.java:535) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.createGitClient ( Jgitenvironmentrepository.java:518) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh ( Jgitenvironmentrepository.java:259) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.getLocations ( Jgitenvironmentrepository.java:238) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.getLocations ( Multiplejgitenvironmentrepository.java:~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at Org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository.findOne ( Abstractscmenvironmentrepository.java:~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at Org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOne ( Multiplejgitenvironmentrepository.java:~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at Org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne ( Compositeenvironmentrepository.java:(~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at Org.springframework.cloud.config.server.environment.EnvironmentEncryptorEnvironmentRepository.findOne ( Environmentencryptorenvironmentrepository.java:~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0). RC2] at org.springframework.cloud.config.server.environment.EnvironmentController.labelled ( Environmentcontroller.java:122) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Org.springframework.cloud.config.server.environment.EnvironmentController.defaultLabel ( Environmentcontroller.java:106) ~[spring-cloud-config-server-2.0.0.rc2.jar:2.0.0. RC2] at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)~[na:1.8. 0_144] at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:) ~[na:1.8. 0_144] at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:~[na:1.8). 0_144] at Java.lang.reflect.Method.invoke (Method.java:498) ~[na:1.8. 0_144] at Org.springframework.web.method.support.InvocableHandlerMethod.doInvoke ( Invocablehandlermethod.java:209) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest ( Invocablehandlermethod.java:136) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle ( Servletinvocablehandlermethod.java:102) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] At Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod ( Requestmappinghandleradapter.java:877) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( Requestmappinghandleradapter.java:783) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( Abstracthandlermethodadapter.java:) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:991) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:925) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:974) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.servlet.FrameworkServlet.doGet (Frameworkservlet.java:866) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Javax.servlet.http.HttpServlet.service (Httpservlet.java:635) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.springframework.web.servlet.FrameworkServlet.service (Frameworkservlet.java:851) ~[spring-webmvc-5.0.6.release.jar:5.0.6. RELEASE] at Javax.servlet.http.HttpServlet.service (Httpservlet.java:742) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:231) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:~[tomcat-embed-websocket-8.5.31.jar:8.5.31)] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics ( Webmvcmetricsfilter.java:158) ~[spring-boot-actuator-2.0.2.release.jar:2.0.2. RELEASE] at Org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics ( Webmvcmetricsfilter.java:126) ~[spring-boot-actuator-2.0.2.release.jar:2.0.2. RELEASE] at Org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal ( Webmvcmetricsfilter.java:111) ~[spring-boot-actuator-2.0.2.release.jar:2.0.2. RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal ( Httptracefilter.java:~[spring-boot-actuator-2.0.2.release.jar:2.0.2). RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.RequestContextFilter.doFilterInternal (Requestcontextfilter.java:~[spring-web-5.0.6.release.jar:5.0.6). RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal (Httpputformcontentfilter.java: 109) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (Hiddenhttpmethodfilter.java: Bayi) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: ~[spring-web-5.0.6.release.jar:5.0.6). RELEASE] at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) ~[spring-web-5.0.6.release.jar:5.0.6. RELEASE] at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:198) ~[tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:(+) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:496) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:(+) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:Bayi) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:342) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.coyote.http11.Http11Processor.service (Http11processor.java:803) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.coyote.AbstractProcessorLight.process (Abstractprocessorlight.java:[tomcat-embed-core-8.5.31.jar:8.5.31]] at org.apache.coyote.abstractprotocol$connectionhandler.process (Abstractprotocol.java:790) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (Nioendpoint.java:1468) [tomcat-embed-core-8.5.31.jar:8.5.31] at Org.apache.tomcat.util.net.SocketProcessorBase.run (Socketprocessorbase.java:) [tomcat-embed-core-8.5.31.jar:8.5.31] at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1149) [na:1.8. 0_144] at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:624) [na:1.8. 0_144] at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (Taskthread.java:) [tomcat-embed-core-8.5.31.jar:8.5.31] at Java.lang.Thread.run (Thread.java:748) [na:1.8.0_144]
A review found that there was an error in calling the Lookuphttpclientbuilder method in the Httpclientconfigurablehttpconnectionfactory class.
I'm debugging after the 69th line breaks.
My URI in the config file is "Https://gitee.com/tree-cai/springCloudDemo.git", and the spec here is
When spec.substring (0, "\") occurs, the problem is not resolved at the moment of arrayindexoutofboundsexception.
So I tried to use the FINCHLEY.RC1 version to find the access OK.
The Httpclientconfigurablehttpconnectionfactory class is not available in the FINCHLEY.RC1 package.
Record it and pit my long time of Spring Cloud Config.
About the spring Cloud "FINCHLEY.RC2" version of arrayindexoutofboundsexception in Spring Cloud Config