【问题标题】:spring cloud config clone-on-start http.postBuffer issuespring cloud config clone-on-start http.postBuffer问题
【发布时间】:2019-01-02 17:39:06
【问题描述】:

我在使用 bitbucket url 启动 spring 云配置服务器时遇到问题 Integer value http.postbuffer out of range

application.yml

server:
    port: 8888

spring:
    application:
        name: CONFIGSERVER
    cloud:
     config:
        label: master
        server:
          git:
            clone-on-start: true
            uri: https://bitbucket.org/MyGitRepo/config_server_env_profiles.git
            username: <username>
            password: <password>

堆栈跟踪

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path
 resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is
 java.lang.IllegalArgumentException: Integer value http.postbuffer out of range
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPost
Processor.java:659)
        ... 96 more
Caused by: java.lang.IllegalArgumentException: Integer value http.postbuffer out of range
        at org.eclipse.jgit.lib.Config.getInt(Config.java:230)
        at org.eclipse.jgit.lib.Config.getInt(Config.java:209)
        at org.eclipse.jgit.transport.TransportHttp$HttpConfig.<init>(TransportHttp.java:247)
        at org.eclipse.jgit.transport.TransportHttp$3.parse(TransportHttp.java:237)
        at org.eclipse.jgit.transport.TransportHttp$3.parse(TransportHttp.java:234)
        at org.eclipse.jgit.lib.Config.get(Config.java:703)
        at org.eclipse.jgit.transport.TransportHttp.<init>(TransportHttp.java:282)
        at org.eclipse.jgit.transport.TransportHttp$1.open(TransportHttp.java:190)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:566)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:443)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:324)
        at org.eclipse.jgit.transport.Transport.open(Transport.java:293)
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:225)
        at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:293)
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:190)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:433)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.initClonedRepository(JGitEnvironmentRepository.java:249)
        at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.afterPropertiesSet(JGitEnvironmentRepository.java:182)
        at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.afterPropertiesSet(MultipleJGitEnvironmentRepository.
java:68)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761
)

可能是什么问题和解决方案?

【问题讨论】:

    标签: git bitbucket jgit spring-cloud-config


    【解决方案1】:

    显然,在克隆时org.eclipse.jgit 库在幕后使用系统配置的属性,其中一个属性是http.postBuffer

    它尝试将值转换为整数,如果值太大(或太小)则失败并出现上述超出范围错误。

    我通过$ git config --get http.postBuffer 验证了该属性,它返回了值4572864000

    我在 .gitconfig 文件中验证,它是全局值,所以我将值减小到 524288000

    然后它就像魅力一样发挥作用。希望对面临同样问题的人有所帮助。

    【讨论】:

      【解决方案2】:

      对我来说有帮助的是将全局配置设置为 1MB:

      git config --global http.postBuffer 1024

      【讨论】:

        猜你喜欢
        • 2016-09-29
        • 2020-09-05
        • 2022-01-14
        • 2016-02-18
        • 2016-05-05
        • 1970-01-01
        • 1970-01-01
        • 2018-08-01
        • 1970-01-01
        相关资源
        最近更新 更多