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)