timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-44653] Unable to update config.xml via cli command #9183

Open timja opened 7 years ago

timja commented 7 years ago

Calling
 ssh -p 2222 user@localhost update-job job_name < config.xml

Results in

ERROR: Unexpected exception occurred while performing update-job command.
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228)
Caused: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191)
at jenkins.util.xml.XMLUtils.safeTransform(XMLUtils.java:69)
at hudson.model.AbstractItem.updateByXml(AbstractItem.java:765)
Caused: java.io.IOException: Failed to persist config.xml
at hudson.model.AbstractItem.updateByXml(AbstractItem.java:768)
at hudson.cli.UpdateJobCommand.run(UpdateJobCommand.java:47)
at hudson.cli.CLICommand.main(CLICommand.java:274)
at org.jenkinsci.main.modules.sshd.CLICommandAdapter$1.run(CLICommandAdapter.java:37)
at org.jenkinsci.main.modules.sshd.AsynchronousCommand$1.run(AsynchronousCommand.java:112)
at java.lang.Thread.run(Thread.java:745)

Originally reported by peter7019, imported from: Unable to update config.xml via cli command
  • status: Open
  • priority: Minor
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 7 years ago

danielbeck:

Are any of the Static Analysis Utilities plugins (Warnings, DRY, etc.) installed, possibly in old versions?

timja commented 7 years ago

peter7019:

envinject is not the latest version, but all others are up to date

ace-editor 1.1
active-directory 2.4
analysis-collector 1.50
analysis-core 1.86
ant 1.5
antisamy-markup-formatter 1.5
authentication-tokens 1.3
bouncycastle-api 2.16.1
branch-api 2.0.9
build-failure-analyzer 1.19.0
built-on-column 1.1
checkstyle 3.48
cloudbees-folder 6.0.4
conditional-buildstep 1.3.5
copyartifact 1.38.1
credentials 2.1.13
credentials-binding 1.11
cvs 2.13
description-setter 1.10
display-url-api 2.0
docker-commons 1.6
docker-workflow 1.11
durable-task 1.13
email-ext 2.57.2
emma 1.29
envinject 1.92.1
Exclusion 0.12
external-monitor-job 1.7
findbugs 4.70
git 3.3.0
git-client 2.4.5
git-parameter 0.8.0
git-server 1.7
greenballs 1.15
groovy 2.0
handlebars 1.1.1
icon-shim 2.0.3
javadoc 1.4
jenkins-multijob-plugin 1.24
job-restrictions 0.6
jobConfigHistory 2.16
jobrevision 0.6
jquery 1.11.2-0
jquery-detached 1.2.1
junit 1.20
ldap 1.15
locale 1.2
mailer 1.20
mapdb-api 1.0.9.0
mask-passwords 2.10.1
matrix-auth 1.5
matrix-project 1.11
maven-plugin 2.15.1
momentjs 1.1.1
next-build-number 1.4
pam-auth 1.3
parameterized-trigger 2.33
pipeline-build-step 2.5
pipeline-graph-analysis 1.3
pipeline-input-step 2.7
pipeline-milestone-step 1.3.1
pipeline-model-api 1.1.4
pipeline-model-declarative-agent 1.1.1
pipeline-model-definition 1.1.4
pipeline-model-extensions 1.1.4
pipeline-rest-api 2.6
pipeline-stage-step 2.2
pipeline-stage-tags-metadata 1.1.4
pipeline-stage-view 2.6
plain-credentials 1.4
postbuild-task 1.8
promoted-builds 2.28.1
publish-over-ssh 1.17
python 1.3
reverse-proxy-auth-plugin 1.5
run-condition 1.0
scm-api 2.1.1
script-security 1.27
ssh-credentials 1.13
ssh-slaves 1.17
structs 1.6
subversion 2.7.2
token-macro 2.1
translation 1.15
windows-slaves 1.3.1
workflow-aggregator 2.5
workflow-api 2.13
workflow-basic-steps 2.4
workflow-cps 2.30
workflow-cps-global-lib 2.8
workflow-durable-task-step 2.11
workflow-job 2.12
workflow-multibranch 2.14
workflow-scm-step 2.4
workflow-step-api 2.9
workflow-support 2.14

timja commented 7 years ago

peter7019:

I updated to Jekins 2.64 and it is working now.
Which change solved this?

timja commented 7 years ago

danielbeck:

None. In my experience this happens when a plugin sets a system property to use a specific XML parser, but it's only on the plugin's class path, resulting in errors everywhere else. FindBugs in this list would be a candidate for that, I think, except that drulli already worked on that issue and resolved it long ago (I think).

timja commented 7 years ago

peter7019:

The problem is back.

I read this article https://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/ and thought this might provide a solution.
But the system property "javax.xml.parsers.DocumentBuilderFactory" is null.

I checked this via my-jenkins-url/jenkins/script:

out.println "javax.xml.parsers.DocumentBuilderFactory=" + System.getProperty("javax.xml.parsers.DocumentBuilderFactory")

I have installed several Java-JDK-Versions. Which one is used when calling the above mentioned update-job command?

Any new ideas?