Jenkins字符串索引超出范围:-1

将Jenkins更新到最新版本,更新了所有插件,现在得到的String索引超出范围:-1错误(下面有完整日志)。

当我将educationStrategy从hudson.security.ProjectMatrixAuthorizationStrategy更改为hudson.security.FullControlOnceLoggedInAuthorizationStrategy时,错误消失了。我可以登录,基本上可以完成我们通常所做的一切。但是当我们将其改回时,错误就在那里。

有人知道如何解决此问题吗?还是从哪里开始调试?

错误日志:

    at java.lang.String.substring(String.java:1967)
    at org.jenkinsci.plugins.matrixauth.AuthorizationContainer.add(AuthorizationContainer.java:76)
    at org.jenkinsci.plugins.matrixauth.AbstractAuthorizationContainerConverter.unmarshalContainer(AbstractAuthorizationContainerConverter.java:82)
    at org.jenkinsci.plugins.matrixauth.AbstractAuthorizationContainerConverter.unmarshal(AbstractAuthorizationContainerConverter.java:94)
    at hudson.util.XStream2$AssociatedConverterImpl.unmarshal(XStream2.java:464)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
Caused: com.thoughtworks.xstream.converters.ConversionException: String index out of range: -1 : String index out of range: -1
---- Debugging information ----
message             : String index out of range: -1
cause-exception     : java.lang.StringIndexOutOfBoundsException
cause-message       : String index out of range: -1
class               : hudson.security.ProjectMatrixAuthorizationStrategy
required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
converter-type      : hudson.util.XStream2$AssociatedConverterImpl
path                : /hudson/authorizationStrategy/denyAnonymousReadaccess
line number         : 14
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:391)
    at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:329)
Caused: jenkins.util.xstream.CriticalXStreamException: String index out of range: -1 : String index out of range: -1
---- Debugging information ----
message             : String index out of range: -1
cause-exception     : java.lang.StringIndexOutOfBoundsException
cause-message       : String index out of range: -1
class               : hudson.security.ProjectMatrixAuthorizationStrategy
required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
converter-type      : hudson.util.XStream2$AssociatedConverterImpl
path                : /hudson/authorizationStrategy/denyAnonymousReadaccess
line number         : 14
------------------------------- : String index out of range: -1 : String index out of range: -1
---- Debugging information ----
message             : String index out of range: -1
cause-exception     : java.lang.StringIndexOutOfBoundsException
cause-message       : String index out of range: -1
class               : hudson.security.ProjectMatrixAuthorizationStrategy
required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
converter-type      : hudson.util.XStream2$AssociatedConverterImpl
path                : /hudson/authorizationStrategy/denyAnonymousReadaccess
line number         : 14
-------------------------------
message             : String index out of range: -1 : String index out of range: -1
---- Debugging information ----
message             : String index out of range: -1
cause-exception     : java.lang.StringIndexOutOfBoundsException
cause-message       : String index out of range: -1
class               : hudson.security.ProjectMatrixAuthorizationStrategy
required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
converter-type      : hudson.util.XStream2$AssociatedConverterImpl
path                : /hudson/authorizationStrategy/denyAnonymousReadaccess
line number         : 14
-------------------------------
cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : String index out of range: -1 : String index out of range: -1
class               : hudson.model.Hudson
required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
converter-type      : hudson.util.RobustReflectionConverter
path                : /hudson/authorizationStrategy/denyAnonymousReadaccess
line number         : 14
version             : not available
-------------------------------
    at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:354)
    at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:268)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1189)
    at hudson.util.XStream2.unmarshal(XStream2.java:161)
    at hudson.util.XStream2.unmarshal(XStream2.java:132)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1173)
    at hudson.XmlFile.unmarshal(XmlFile.java:178)
Caused: java.io.IOException: Unable to read /var/jenkins_home/config.xml
    at hudson.XmlFile.unmarshal(XmlFile.java:181)
    at hudson.XmlFile.unmarshal(XmlFile.java:161)
    at jenkins.model.Jenkins.loadConfig(Jenkins.java:3078)
    at jenkins.model.Jenkins.access$1200(Jenkins.java:312)
    at jenkins.model.Jenkins$13.run(Jenkins.java:3180)
    at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
    at jenkins.model.Jenkins$5.runTask(Jenkins.java:1118)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused: org.jvnet.hudson.reactor.ReactorException
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
    at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
    at jenkins.model.Jenkins.executeReactor(Jenkins.java:1152)
    at jenkins.model.Jenkins.<init>(Jenkins.java:959)
    at hudson.model.Hudson.<init>(Hudson.java:85)
    at hudson.model.Hudson.<init>(Hudson.java:81)
    at hudson.WebAppMain$3.run(WebAppMain.java:233)
Caused: hudson.util.HudsonFailedToLoad
    at hudson.WebAppMain$3.run(WebAppMain.java:250)

我们的配置:

<hudson>
  <disabledAdministrativeMonitors>
    <string>OldData</string>
    <string>jenkins.security.s2m.MasterKillSwitchWarning</string>
    <string>jenkins.security.csrf.CSRFAdministrativeMonitor</string>
  </disabledAdministrativeMonitors>
  <version>2.190.2</version>
  <installStateName>DOWNGRADE</installStateName>
  <numExecutors>2</numExecutors>
  <mode>NORMAL</mode>
  <useSecurity>true</useSecurity>
  <authorizationStrategy class="hudson.security.ProjectMatrixAuthorizationStrategy">
    <denyAnonymousReadaccess>false</denyAnonymousReadaccess>
  </authorizationStrategy>
  <securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
    <disableSignup>true</disableSignup>
    <enableCaptcha>false</enableCaptcha>
  </securityRealm>
  <disableRememberMe>false</disableRememberMe>
  <projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
  <workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}</workspaceDir>
  <buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
  <markupFormatter class="hudson.markup.EscapedMarkupFormatter"/>
  <jdks/>
  <viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
  <myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
  <clouds/>
  <quietPeriod>5</quietPeriod>
  <scmCheckoutRetryCount>0</scmCheckoutRetryCount>
  <views>
  ...
  </views>                                                                                                              
  <primaryView>all</primaryView>                                                                                        
  <slaveAgentPort>50000</slaveAgentPort>                                                                                
  <label></label>                                                                                                       
  <nodeProperties/>                                                                                                     
  <globalNodeProperties/>                                                                                               
</hudson>
zhuangmisi 回答:Jenkins字符串索引超出范围:-1

如果要更新,则config.xml中可能存在语法错误。您可以尝试恢复:

停止詹金斯

cmd> service jenkins stop

移动或复制config.xml文件

cmd> mv Jenkins_Home/config.xml Jenkins_Home/config_copy.xml

再次启动Jenkins

cmd> service jenkins start

或者如果您有git插件,可能是一个问题,有时可以通过将git版本更改为较旧的版本来解决。

本文链接:https://www.f2er.com/3108967.html

大家都在问