java XML 解析问题 - FactoryConfigurationError:未找到提供程序
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
出于好奇,我将 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).