java XML 解析问题 - FactoryConfigurationError:未找到提供程序

发布于 2024-09-06 10:45:55 字数 541 浏览 1 评论 0原文

我有一个 java 小程序,可以解析 xml 字符串。但是,运行以下代码:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse(xml);

生成以下错误:

javax.xml.parsers.FactoryConfigurationError: Provider <HTML> not found

我在发布之前检查过的一些论坛表明我需要将 2 个 jar 文件 - xercesImpl.jar 和 xmlParserAPIs.jar - 添加到我的 JRE_HOME/lib/ext 目录。但是,我不认为这是问题所在,因为该小程序当前托管在 2 个不同的网络服务器上,其中一个运行正常,而另一个则失败。我看了看,jre/lib/ext 目录中也没有这些 jar。

非常感谢任何帮助。

I have a java applet that parses a string of xml. However, running the following code:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse(xml);

Generates the following error:

javax.xml.parsers.FactoryConfigurationError: Provider <HTML> not found

Some forums I've checked prior to posting indicated that I need to add 2 jar files - xercesImpl.jar and xmlParserAPIs.jar - to my JRE_HOME/lib/ext directory. However, I don't think this is the problem because this applet is currently hosted on 2 different webservers and one functions perfectly while the other fails. I looked, and neither have those jars in the jre/lib/ext directory.

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的心境我的脸 2024-09-13 10:45:55

出于好奇,我将 xercesImpl 添加到了搞砸了的网络服务器上的小程序存档中,一切顺利。我不知道为什么它在没有这个 jar 的其他环境中运行(也许它在那里,但我只是没有看到它)。

Just out of curiosity, I added xercesImpl to the applet archive on the webserver that was screwing up, and things work peachy king. I have no idea why it is functioning in the other environment without this jar (maybe it's there and I just didn't see it).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文