在 Tomcat7 服务器上用 Java 创建新实例时 XmlPullParser 异常

在 Tomcat7 服务器上用 Java 创建新实例时 XmlPullParser 异常

问题描述:

我正在使用带有 Tomcat 7 和 jre 7 的 Eclipse 开发动态 Web 应用程序.尝试解析 xml 字符串时收到以下异常:

I am working on a dynamic web app using Eclipse with Tomcat 7 and jre 7. I receive the following exception when attempting to parse an xml string:

无法加载任何工厂类(即使是小的或完整的默认实现);嵌套异常是:org.kxml2.io.XmlReader

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();

它是 org.xmlpull.v1.XmlPullParserFactory 命名空间的一部分.

which is part of the org.xmlpull.v1.XmlPullParserFactory namespace.

我已将 xmlpull_1_0_5.jar 放入 Tomcat lib 文件夹并重新启动它.我也把文件放在 WEB-INF lib 文件夹中.

I have put the xmlpull_1_0_5.jar into the Tomcat lib folder and restart it. I have also put the file in the WEB-INF lib folder.

任何帮助将不胜感激!谢谢!

Any help would be appreciated! Thanks!

删除您拥有的一个并使用 KXML2 实现.从这里下载:link

Remove the one you have and use the KXML2 implementation. Download from here: link

更多信息