[JIRA] (JENKINS-41515) Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype

300 views
Skip to first unread message

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 8:49:02 AM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev created an issue
 
Jenkins / Bug JENKINS-41515
Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline
Created: 2017/Jan/27 1:48 PM
Environment: Jenkins 2.19.1, 2.32.1
Priority: Blocker Blocker
Reporter: Nikolay Nachev

If I try to read an xml file within a pipeline with XmlSluper:

String versionPrefix = this.adaptVersionPrefix(releasePrefix)
	String nexusUrl = "${env.NEXUS_BASE_URL}/service/local/repositories/${repository}/content/${group.replaceAll('\\.','/') + '/' + artifact}/maven-metadata.xml"
	URL metadataUrl = new URL(nexusUrl)
	URLConnection connection = metadataUrl.openConnection()
	if (connection.responseCode == 404) {
		// returned all the first time
		return versionPrefix + '1'
	} else if (connection.responseCode == 200) {
		String xmlContent = connection.content.text
		def metadata = new XmlSlurper().parseText(xmlContent)
		List<Integer> maxVersion = []
		for (GPathResult pathResult : metadata.'versioning'.'versions'.'version') {
			if (pathResult.toString().startsWith(versionPrefix)) {
				maxVersion << Integer.valueOf(pathResult.text() - versionPrefix)
			}
		}
		if (maxVersion.isEmpty()) {
			// only one by new release
			return versionPrefix + '1'
		} else {
			return versionPrefix + (maxVersion.sort().last() + 1);
		}
	} else {
		throw new Exception("Unknown response code (${connection.responseCode}) from nexus url ${nexusUrl}. Exit job...")
	}

an error is thrown:

javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
	at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:311)
	at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
	at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
	at groovy.xml.FactorySupport$2.run(FactorySupport.java:58)
	at java.security.AccessController.doPrivileged(Native Method)
	at groovy.xml.FactorySupport.createFactory(FactorySupport.java:35)
	at groovy.xml.FactorySupport.createSaxParserFactory(FactorySupport.java:56)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:128)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:114)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:101)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
	at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:194)
	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onNewInstance(GroovyInterceptor.java:40)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:128)
	at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:191)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedConstructor(Checker.java:188)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.constructorCall(SandboxInvoker.java:20)
	at Script1.getArtifactBuildVersion(Script1.groovy:129)
	at WorkflowScript.run(WorkflowScript:34)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:96)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:77)
	at sun.reflect.GeneratedMethodAccessor373.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
	at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:308)
	at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
	at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
	at groovy.xml.FactorySupport$2.run(FactorySupport.java:58)
	at java.security.AccessController.doPrivileged(Native Method)
	at groovy.xml.FactorySupport.createFactory(FactorySupport.java:35)
	at groovy.xml.FactorySupport.createSaxParserFactory(FactorySupport.java:56)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:128)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:114)
	at groovy.util.XmlSlurper.<init>(XmlSlurper.java:101)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)

The error line 131 looks like:

def metadata = new XmlSlurper().parseText(xmlContent)
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 8:51:01 AM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev updated an issue
Change By: Nikolay Nachev
If I try to read an xml file within a pipeline with XmlSluper:

{code}

String versionPrefix = this.adaptVersionPrefix(releasePrefix)
String nexusUrl = "${env.NEXUS_BASE_URL}/service/local/repositories/${repository}/content/${group.replaceAll('\\.','/') + '/' + artifact}/maven-metadata.xml"
URL metadataUrl = new URL(nexusUrl)
URLConnection connection = metadataUrl.openConnection()
if (connection.responseCode == 404) {
  // returned all the first time
  return versionPrefix + '1'
} else if (connection.responseCode == 200) {
  String xmlContent = connection.content.text
  def metadata = new XmlSlurper().parseText(xmlContent)
  List<Integer> maxVersion = []
  for (GPathResult pathResult : metadata.'versioning'.'versions'.'version') {
   if (pathResult.toString().startsWith(versionPrefix)) {
    maxVersion << Integer.valueOf(pathResult.text() - versionPrefix)
   }
  }
  if (maxVersion.isEmpty()) {
   // only one by new release
   return versionPrefix + '1'
  } else {
   return versionPrefix + (maxVersion.sort().last() + 1);
  }
} else {
  throw new Exception("Unknown response code (${connection.responseCode}) from nexus url ${nexusUrl}. Exit job...")
}
{code}

an error is thrown:

{code}
{code}


The error line 131 looks like:
{code}

def metadata = new XmlSlurper().parseText(xmlContent)
{code}

Even if I try to initialize the XmlSluper class, the same error is thrown

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 8:51:01 AM1/27/17
to jenkinsc...@googlegroups.com
Even if I try only to initialize the XmlSluper class, the same error is thrown

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 9:38:02 AM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev commented on Bug JENKINS-41515
 
Re: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype

After long investigation of the problem, I've found finally the cause of the error. It is the JaCoCo Plugin. If the plugin is installed and active the error occurs.

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 9:43:02 AM1/27/17
to jenkinsc...@googlegroups.com

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 9:48:02 AM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev updated an issue
If I try to read an xml file within a pipeline with XmlSluper:

{code}
String versionPrefix = this.adaptVersionPrefix(releasePrefix)
String nexusUrl = "${env.NEXUS_BASE_URL}/service/local/repositories/${repository}/content/${group.replaceAll('\\.','/') + '/' + artifact}/maven-metadata.xml"
URL metadataUrl = new URL(nexusUrl)
URLConnection connection = metadataUrl.openConnection()
if (connection.responseCode == 404) {
  // returned all the first time
  return versionPrefix + '1'
} else if (connection.responseCode == 200) {
  String xmlContent = connection.content.text
  def metadata rootNode = new XmlSlurper().parseText( xmlContent)
  List<Integer> maxVersion = []
  for (GPathResult pathResult : metadata.
' versioning ' . ' versions'.'version') { <root>
   if (pathResult.toString().startsWith(versionPrefix)) {
    maxVersion
< a>one! < Integer.valueOf(pathResult.text() - versionPrefix) /a>
   }
  }
  if (maxVersion.isEmpty()) {
                 <a>two!<    / / only one by new release a>
   return versionPrefix +                </root> ' 1 ' ' )
  } else {
   return versionPrefix + (maxVersion
        
assert rootNode
. sort() a . last size () + 1); == 2
  }
} else
{
  throw new Exception("Unknown response
code (${connection.responseCode } ) from nexus url ${nexusUrl}. Exit job...")
}
{code}

an error is thrown:

{code}
javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:311)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
at groovy.xml.FactorySupport$2.run(FactorySupport.java:58)
at java.security.AccessController.doPrivileged(Native Method)
at groovy.xml.FactorySupport.createFactory(FactorySupport.java:35)
at groovy.xml.FactorySupport.createSaxParserFactory(FactorySupport.java:56)
at groovy.util.XmlSlurper.<init>(XmlSlurper.java:128)
at groovy.util.XmlSlurper.<init>(XmlSlurper.java:114)
at groovy.util.XmlSlurper.<init>(XmlSlurper.java:101)
at sun.reflect. NativeConstructorAccessorImpl GeneratedConstructorAccessor408 . newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.
newInstance( NativeConstructorAccessorImpl.java:62 Unknown Source )

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:194)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onNewInstance(GroovyInterceptor.java:40)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:128)
at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:191)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedConstructor(Checker.java:188)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.constructorCall(SandboxInvoker.java:20)
at
Script1.getArtifactBuildVersion(Script1.groovy:129)
at
WorkflowScript.run(WorkflowScript: 34 33 )

at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:96)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:77)
at sun.reflect. GeneratedMethodAccessor373 GeneratedMethodAccessor518 .invoke(Unknown Source)
at sun.reflect. NativeConstructorAccessorImpl GeneratedConstructorAccessor408 . newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.
newInstance( NativeConstructorAccessorImpl.java:62 Unknown Source )

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
{code} at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
The error line 131 looks like at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java : 194)
{code} at org.kohsuke.groovy.sandbox.GroovyInterceptor.onNewInstance(GroovyInterceptor.java:40)
def metadata = new XmlSlurper at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance ( SandboxInterceptor.java:128 )
at org
. parseText kohsuke.groovy.sandbox.impl.Checker$3.call ( xmlContent Checker.java:191 )
at org.kohsuke.groovy.sandbox.impl.Checker.checkedConstructor(Checker.java:188)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.constructorCall(SandboxInvoker.java:20)
... 28 more
Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:294)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
... 50 more
{code}

Even if I try only to initialize the XmlSluper class, the same error is thrown

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 12:07:01 PM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev edited a comment on Bug JENKINS-41515
After long investigation of the problem, I've found finally the cause of the error. It is the [JaCoCo Plugin|https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin]. If the plugin is installed and active actived the error occurs.

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 12:08:02 PM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev edited a comment on Bug JENKINS-41515
After long investigation of the problem, I've found finally the cause of the error. It is the [JaCoCo Plugin|https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin]. If the plugin is installed and activated the error occurs.

niko.nachev@gmail.com (JIRA)

unread,
Jan 27, 2017, 12:08:02 PM1/27/17
to jenkinsc...@googlegroups.com
Nikolay Nachev edited a comment on Bug JENKINS-41515
After long investigation of the problem, I've found finally the cause of the error. It is the [JaCoCo Plugin|https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin]. If the plugin is installed and actived activated the error occurs.

jglick@cloudbees.com (JIRA)

unread,
Jan 30, 2017, 10:14:01 AM1/30/17
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Ognjen Bubalo
 

jacoco.hpi includes WEB-INF/lib/xercesImpl-2.9.1.jar and WEB-INF/lib/xml-apis-1.0.b2.jar, which is unnecessary and harmful. Please set up <excludes> in your POM and review bundled JARs—there are far too many and most are likely unused.

Change By: Jesse Glick
Component/s: pipeline
Labels: pipeline
Assignee: Ognjen Bubalo

jglick@cloudbees.com (JIRA)

unread,
Jan 30, 2017, 11:16:01 AM1/30/17
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-41515
 
Re: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype

That said, be advised that use of XmlSlurper and similar utilities from Pipeline script is not supported. Perform any such processing outside of Jenkins, in sh/bat steps.

pavel.vasilev.georgiev@gmail.com (JIRA)

unread,
Mar 8, 2017, 2:45:01 AM3/8/17
to jenkinsc...@googlegroups.com

This issue seems to be the cause of this one:

 

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

pavel.vasilev.georgiev@gmail.com (JIRA)

unread,
Mar 8, 2017, 2:46:03 AM3/8/17
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Mar 24, 2017, 5:52:05 AM3/24/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Dominik Stadler
Path:
pom.xml
http://jenkins-ci.org/commit/jacoco-plugin/4baa40f8fb07cda1159880769e0f92024183d152
Log:
JENKINS-41515:

  • Update Jenkins parent to 1.625.3 to be able to test with current pipeline-plugin
  • Adjust dependencies and add some exclusions to remove a number of unnecessary jars from the resulting hpi file

dominik.stadler@gmx.at (JIRA)

unread,
Mar 24, 2017, 6:09:02 AM3/24/17
to jenkinsc...@googlegroups.com
centic resolved as Fixed
 

Fixed on master by adding some excludes in the pom, this will become available with version 2.2.1 and newer.

Change By: centic
Status: Open Resolved
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages