Querying Work Item Type produces linkage error
When attempting to create a work item using the Java Plain API (using groovy method shown here: How can I script Jazz/RTC using Groovy? - Jazz Forum) I have run into a Linkage error when attempting to get a Work Item Type object from the repository:
[2021-08-05T13:38:28.711Z] class path: F:\ProgramFiles\Groovy\Groovy-2.4.16\lib\groovy-2.4.16.jar [2021-08-05T13:38:28.711Z] Caught: java.lang.LinkageError: loader constraint violation in interface itable initialization for class org.apache.xerces.dom.NodeImpl: when selecting method 'org.w3c.dom.NodeList org.w3c.dom.Node.getChildNodes()' the class loader 'bootstrap' for super interface org.w3c.dom.Node, and the class loader org.codehaus.groovy.tools.RootLoader @326de728 of the selected method's abstract class, org.apache.xerces.dom.NodeImpl have different Class objects for the type org.w3c.dom.NodeList used in the signature (org.w3c.dom.Node is in module java.xml of loader 'bootstrap'; org.apache.xerces.dom.NodeImpl is in unnamed module of loader org.codehaus.groovy.tools.RootLoader @326de728, parent loader 'app') [2021-08-05T13:38:28.712Z] java.lang.LinkageError: loader constraint violation in interface itable initialization for class org.apache.xerces.dom.NodeImpl: when selecting method 'org.w3c.dom.NodeList org.w3c.dom.Node.getChildNodes()' the class loader 'bootstrap' for super interface org.w3c.dom.Node, and the class loader org.codehaus.groovy.tools.RootLoader @326de728 of the selected method's abstract class, org.apache.xerces.dom.NodeImpl have different Class objects for the type org.w3c.dom.NodeList used in the signature (org.w3c.dom.Node is in module java.xml of loader 'bootstrap'; org.apache.xerces.dom.NodeImpl is in unnamed module of loader org.codehaus.groovy.tools.RootLoader @326de728, parent loader 'app') [2021-08-05T13:38:28.712Z] at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) [2021-08-05T13:38:28.712Z] at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) [2021-08-05T13:38:28.712Z] at com.ibm.team.process.internal.common.util.XMLUtil.getXmlDocument(XMLUtil.java:167) [2021-08-05T13:38:28.712Z] at com.ibm.team.process.internal.client.ThinClientProcess.createRepresentation(ThinClientProcess.java:791) [2021-08-05T13:38:28.712Z] at com.ibm.team.process.internal.client.ThinClientProcess.fetchConfigurationData(ThinClientProcess.java:306) [2021-08-05T13:38:28.712Z] at com.ibm.team.process.internal.client.ThinClientProcess.getConfigurationData(ThinClientProcess.java:297) [2021-08-05T13:38:28.712Z] at com.ibm.team.process.internal.client.ThinClientProcess.getProjectConfigurationData(ThinClientProcess.java:278) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.client.internal.AuditableClientProcess.findProcessConfiguration(AuditableClientProcess.java:72) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.resolveProcessConfiguration(ConfigurationItemManager.java:124) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.readConfigurationItems(ConfigurationItemManager.java:107) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.WorkItemTypeManager.readConfigurationItems(WorkItemTypeManager.java:379) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.updateCache(ConfigurationItemManager.java:99) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:107) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:73) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:65) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.findConfigurationItem(ConfigurationItemManager.java:70) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.WorkItemTypeManager.findConfigurationItem(WorkItemTypeManager.java:247) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.WorkItemTypeManager.findConfigurationItem(WorkItemTypeManager.java:242) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.internal.WorkItemCommon.findWorkItemType(WorkItemCommon.java:452) [2021-08-05T13:38:28.712Z] at com.ibm.team.workitem.common.IWorkItemCommon$findWorkItemType$1.call(Unknown Source) [2021-08-05T13:38:28.712Z] at das.RTC.createWI(RTC.groovy:971) [2021-08-05T13:38:28.712Z] at das.RTC$createWI$9.call(Unknown Source) [2021-08-05T13:38:28.712Z] at Get_BD_Properties.run(Get_BD_Properties.groovy:28) [2021-08-05T13:38:28.712Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [2021-08-05T13:38:28.712Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [2021-08-05T13:38:28.712Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
How would I correct such an issue? Do I need to exclude a jar from the classpath?And if the fix is not obtainable, is there another way to obtain an IWorkItemType other than through IWorkItemCommon.findWorkItemType?
One answer
There is a class loader error involving Xerces. I am not sure if Xerces should be involved. I would suggest to xheck if the Plain Java Code runs in Java only and then check with Groovy. In case that fails I'd try Groovy forums.
Comments
Xerces is in the jazz build toolkit. When I try to omit the xerces jar from the classpath, it immediately fails with
[2021-08-05T16:04:18.927Z] Caught: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found [2021-08-05T16:04:18.927Z] javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found [2021-08-05T16:04:18.927Z] at org.eclipse.core.runtime.spi.RegistryStrategy.getXMLParser(RegistryStrategy.java:382) [2021-08-05T16:04:18.927Z] at org.eclipse.core.internal.registry.ExtensionRegistry.addContribution(ExtensionRegistry.java:1062)
and fails TeamPlatform.startup().