尝试使用 DocumentBuilder 加载/解析 XML 文件时出错

Error trying to load / parse XML file with DocumentBuilder

我正在尝试加载 XML 文件,但在将 Katalon 从 6.1.5 更新到 6.2 后开始出现错误。

问题错误: java.lang.NoClassDefFoundError: org/w3c/dom/elementtraversal

尝试解析文件时抛出错误。

即使错误很明显 class 未被识别/找到;我排除了格式错误的 XML 文件。

File docXmlFile = new File("C:\data", "info.xml");
DocumentBuilderFactory factory = DocumentFactoryBuilder.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(docXmlFile); // error is thrown here!
Element root = doc.getDocumentElement(); // this line isn't reached

试图弄清楚发生了什么变化,因为这段代码已经运行了很长一段时间。

如果我不得不猜测它可能是某种依赖关系或缺少 JAR 文件,我不确定是哪一个以及如何修复它。

根据 Katalon 论坛上的 this post,这是一个已知问题,已在版本 6.2.1.

中修复