[JIRA] (JENKINS-38895) Job DSL fails to add new job

302 views
Skip to first unread message

andbtk@telesoftas.com (JIRA)

unread,
Oct 11, 2016, 8:26:01 AM10/11/16
to jenkinsc...@googlegroups.com
Andrius Butkevicius created an issue
 
Jenkins / Bug JENKINS-38895
Job DSL fails to add new job
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2016/Oct/11 12:25 PM
Environment: Jenkins 2.25, job-dsl-plugin 1.51
Priority: Minor Minor
Reporter: Andrius Butkevicius

I have DSL script that creates new job for every banch read from separate text file.
Sometimes this job which processes DSL script fails to create new job defined in DSL.
Job log indicates that new job creation succeeded:

Existing items:
    ...
    GeneratedJob{name='GameON_feature-click_on_logo_opens_menu_android'}
    ...

But it doesn't show in jenkins ui and job files are not created on disk.
In jenkins log I found this error:

INFO: createOrUpdateConfig for GameON_feature-click_on_logo_opens_menu_android
Oct 11, 2016 10:25:17 AM javaposse.jobdsl.plugin.JenkinsJobManagement createNewItem
WARNING: Error writing config for new item GameON_feature-click_on_logo_opens_menu_android.
java.io.IOException: Failed to persist config.xml
        at hudson.model.ItemGroupMixIn.createProjectFromXML(ItemGroupMixIn.java:297)
        at jenkins.model.Jenkins.createProjectFromXML(Jenkins.java:3749)
        at javaposse.jobdsl.plugin.JenkinsJobManagement.createNewItem(JenkinsJobManagement.java:533)
        at javaposse.jobdsl.plugin.JenkinsJobManagement.createOrUpdateConfig(JenkinsJobManagement.java:148)
        at javaposse.jobdsl.dsl.JobManagement$createOrUpdateConfig$5.call(Unknown Source)
        at javaposse.jobdsl.plugin.InterruptibleJobManagement.createOrUpdateConfig(InterruptibleJobManagement.groovy:37)
        at javaposse.jobdsl.dsl.JobManagement$createOrUpdateConfig$5.call(Unknown Source)
        at javaposse.jobdsl.dsl.DslScriptLoader$_extractGeneratedJobs_closure4.doCall(DslScriptLoader.groovy:212)
        at sun.reflect.GeneratedMethodAccessor2351.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
        at groovy.lang.Closure.call(Closure.java:414)
        at groovy.lang.Closure.call(Closure.java:430)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
        at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at javaposse.jobdsl.dsl.DslScriptLoader.extractGeneratedJobs(DslScriptLoader.groovy:203)
        at javaposse.jobdsl.dsl.DslScriptLoader.this$2$extractGeneratedJobs(DslScriptLoader.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java::

Restarting jenkins and running main DSL job again fixes this problem.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

andbtk@telesoftas.com (JIRA)

unread,
Oct 11, 2016, 8:31:05 AM10/11/16
to jenkinsc...@googlegroups.com
Andrius Butkevicius updated an issue
Change By: Andrius Butkevicius
I have DSL script that creates new job for every banch read from separate text file.
Sometimes this job which processes DSL script fails to create new job defined in DSL.
Job log indicates that new job creation succeeded:
{code:java}

Existing items:
    ...
    GeneratedJob{name='GameON_feature-click_on_logo_opens_menu_android'}
    ...
{code}

But it doesn't show in jenkins ui and job files are not created on disk.
In jenkins log I found this error:

{code:java}
{code}


Restarting jenkins and running main DSL job again fixes this problem.

DSL:

{code:java}
def branches = []
readFileFromWorkspace("branches.txt").eachLine { branches << it }

branches.each {
    def branchName = it.replaceAll('\'', '')
    def jobName = "GameON_${branchName.substring(7)}_android".replaceAll('/', '-')
    job(jobName) {
        displayName("GameON ${branchName}")
        ...
    }
    if (!jenkins.model.Jenkins.instance.getItemByFullName(jobName)) {
        queue(jobName)
    }
}
{code}

mail@daniel-spilker.com (JIRA)

unread,
Oct 12, 2016, 3:56:02 AM10/12/16
to jenkinsc...@googlegroups.com
Daniel Spilker commented on Bug JENKINS-38895
 
Re: Job DSL fails to add new job

There are several related issues, see https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20text%20~%20%22Failed%20to%20persist%20config.xml%22.

Unfortunaletly the IOException is not very helpful since it's not the root of the problem. But it's cause should have been logged right below starting with Caused by:. Can you provide the complete exception including all "Caused by" exceptions?

andbtk@telesoftas.com (JIRA)

unread,
Oct 12, 2016, 4:22:02 AM10/12/16
to jenkinsc...@googlegroups.com
Andrius Butkevicius updated an issue
Change By: Andrius Butkevicius
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java: 69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java
: 174)
at javaposse.jobdsl.dsl.DslScriptLoader$_runScriptsWithClassLoader_closure1.doCall(DslScriptLoader.groovy:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2068)
at org.codehaus.groovy.runtime.dgm$164.invoke(Unknown Source)

at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader(DslScriptLoader.groovy:68)
at javaposse.jobdsl.dsl.DslScriptLoader.this$2$runScriptsWithClassLoader(DslScriptLoader.groovy)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
at javaposse.jobdsl.dsl.DslScriptLoader.runScripts(DslScriptLoader.groovy:44)
at javaposse.jobdsl.plugin.ExecuteDslScripts.perform(ExecuteDslScripts.java:327)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:401)
Caused by: 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:66)
at hudson.model.ItemGroupMixIn.createProjectFromXML(ItemGroupMixIn.java:274)
... 74 more
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228)
... 77 more

{code}

Restarting jenkins and running main DSL job again fixes this problem.

DSL:

{code:java}
def branches = []
readFileFromWorkspace("branches.txt").eachLine { branches << it }

branches.each {
    def branchName = it.replaceAll('\'', '')
    def jobName = "GameON_${branchName.substring(7)}_android".replaceAll('/', '-')
    job(jobName) {
        displayName("GameON ${branchName}")
        ...
    }
    if (!jenkins.model.Jenkins.instance.getItemByFullName(jobName)) {
        queue(jobName)
    }
}
{code}

andbtk@telesoftas.com (JIRA)

unread,
Oct 12, 2016, 4:22:02 AM10/12/16
to jenkinsc...@googlegroups.com

andbtk@telesoftas.com (JIRA)

unread,
Oct 12, 2016, 4:32:02 AM10/12/16
to jenkinsc...@googlegroups.com

Plugins:

# grep -ir 'org.xml.sax.driver' *
Binary file analysis-core/WEB-INF/lib/xercesImpl-2.11.0.jar matches
Binary file findbugs/WEB-INF/lib/library-2.0.4.jar matches
Binary file jacoco/WEB-INF/lib/xercesImpl-2.9.1.jar matches
Binary file jdepend/WEB-INF/lib/xercesImpl-2.8.1.jar matches
Binary file jshint-checkstyle/WEB-INF/lib/xercesImpl-2.8.1.jar matches
Binary file jslint-checkstyle/WEB-INF/lib/xercesImpl-2.8.1.jar matches

mail@daniel-spilker.com (JIRA)

unread,
Oct 12, 2016, 5:45:03 AM10/12/16
to jenkinsc...@googlegroups.com
Daniel Spilker resolved as Duplicate
 
Change By: Daniel Spilker
Status: Open Resolved
Resolution: Duplicate

andbtk@telesoftas.com (JIRA)

unread,
Oct 12, 2016, 5:56:04 AM10/12/16
to jenkinsc...@googlegroups.com
 
Re: Job DSL fails to add new job

How to solve this problem?

mail@daniel-spilker.com (JIRA)

unread,
Oct 12, 2016, 6:03:01 AM10/12/16
to jenkinsc...@googlegroups.com

Ask in JENKINS-27548. Maybe you need to update the plugins mentioned in that ticket.

iyad.al@gmx.de (JIRA)

unread,
Oct 13, 2016, 6:27:02 AM10/13/16
to jenkinsc...@googlegroups.com
Iyad Al commented on Bug JENKINS-38895

Andrius Butkevicius Do you use a folder element in your Job DSL? I use the same Jenkins and Job DSL version and get the same error. When I remove whitespaces in folder it works

Throws exception: java.io.IOException: Failed to persist config.xml

folder("with whitespace")

Works fine

folder("without_whitespace")

Daniel Spilker The XMLUtils.safeTransform()-method seems to have problems with whitespaces. It would be great, if you can fix it. I can't rename all folders with underscore

iyad.al@gmx.de (JIRA)

unread,
Oct 13, 2016, 7:38:03 AM10/13/16
to jenkinsc...@googlegroups.com
Iyad Al reopened an issue
 
Change By: Iyad Al
Resolution: Duplicate
Status: Resolved Reopened

mail@daniel-spilker.com (JIRA)

unread,
Oct 13, 2016, 7:42:04 AM10/13/16
to jenkinsc...@googlegroups.com
Daniel Spilker resolved as Duplicate
Change By: Daniel Spilker
Status: Reopened Resolved
Resolution: Duplicate

mail@daniel-spilker.com (JIRA)

unread,
Oct 17, 2016, 11:08:01 AM10/17/16
to jenkinsc...@googlegroups.com
Daniel Spilker closed an issue as Duplicate
Change By: Daniel Spilker
Status: Resolved Closed
Reply all
Reply to author
Forward
0 new messages