'Linkage error when running groovy script - loader constraint violation in interface itable initialization for class org.apache.xerces.dom.NodeImpl
I've created a groovy script that uses an external Java API (the IBM EWM Build toolkit) to get various attributes of work items for the tool. I'm pulling this external set of libraries using groovy's -cp claspath switch. I'm running into a conflict between the classes used by this toolkit and the internal groovy XML parsing classes:
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')
[2022-03-03T13:46:14.198Z] 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')
The problem isn't in my own code, but in some of the API calls I'm making to the external library that call the conflicting class. Is there any way I can get groovy to recognize the external library in this instance rather than the internal one loaded by RootLoader?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
