Jenkins Build Issue because of "com.sun.org.apache.xpath.internal.XPathAPI (in module java.xml) because module java.xml does not export com.sun.org.apache.xpath.internal"

During Jenkins build, getting the below build error. I am using java 17 as the JDK . The same build if I do externally it works fine. Kindly help

java.lang.IllegalAccessError: class com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15 (in unnamed module @0x70ece772) cannot access class com.sun.org.apache.xpath.internal.XPathAPI (in module java.xml) because module java.xml does not export com.sun.org.apache.xpath.internal to unnamed module @0x70ece772
at com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15.analyse(XPathAnalyser15.java:28)
at com.oopsconsultancy.xmltask.XmlReplace.apply(XmlReplace.java:72)
at com.oopsconsultancy.xmltask.XmlReplacement.apply(XmlReplacement.java:61)

Hi Ranganath,
May I know how did you resolve the error you seen ?

I am facing similar issue after upgrade from Java 11 to Java 17 into my Jenkins 2.387.2.
Any one know how to address it? Or I should rollback to Java 11?

Error is below:
FATAL: class Script1 (in unnamed module @0x773db442) cannot access class com.sun.org.apache.xml.internal.serialize.XMLSerializer (in module java.xml) because module java.xml does not export com.sun.org.apache.xml.internal.serialize to unnamed module @0x773db442
java.lang.IllegalAccessError: class Script1 (in unnamed module @0x773db442) cannot access class com.sun.org.apache.xml.internal.serialize.XMLSerializer (in module java.xml) because module java.xml does not export com.sun.org.apache.xml.internal.serialize to unnamed module @0x773db442

Regards,
Rodrigo.

What are you doing that is using java.xml class? Are you using raw java classes in your pipelines or something?

Generally follow upgrade guide, and upgrade plugins, and you are usually okay.