ClassCastException:org.apache.xerces.parsers.XIncludeAwareParserConfiguration不能转换为org.apache.xerces.xni.parser.XMLParserConfiguration [英] ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

查看:536
本文介绍了ClassCastException:org.apache.xerces.parsers.XIncludeAwareParserConfiguration不能转换为org.apache.xerces.xni.parser.XMLParserConfiguration的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse中开发GWT应用程序,并使用jdom2来读取一些自定义的xml属性文件。



在最近更新之后,我的应用程序现在失败,出现上述错误尝试读取xml文件。相关的堆栈跟踪是:

  org.apache.xerces.parsers.XIncludeAwareParserConfiguration不能转换为org.apache.xerces.xni .parser.XMLParserConfiguration 
org.apache.xerces.parsers.SAXParser。< init>(未知来源)
org.apache.xerces.parsers.SAXParser。< init>(未知来源)
org.apache.xerces.jaxp.SAXParserImpl $ JAXPSAXParser。< init>(未知源)
org.apache.xerces.jaxp.SAXParserImpl。< init>(未知源)
org。 apache.rar .java:871)
org.jdom2.input.SAXBuilder.buildEngine(SAXBuilder.java:854)
org.jdom2.input.SAXBuilder.getEngine(SAXBuilder.java:904)
org .jdom2.input.SAXBuilder.build(SAXBuilder.java:1116)
uk.co.platosys.db.jdbc.DatabaseProperties.loadProperties(DatabaseProperties.java:78)

研究此问题表明,在类路径中存在不兼容版本的xerces jars时可能会出现此错误。



gwt-dev-2.6.1.jar包含xerces包,我的预期是,这个最新版本的gwt-dev已经捆绑了一个不兼容的版本。然而,jdom2.0.5是当前版本,与2.11版本的Xerces一起发布,似乎是Apache发布的最新版本。把这些罐子放在我的路上似乎没有解决问题;我以前已经能够依赖于gwt-dev中的版本。



我宁愿在我的智慧结束这一点,相当于我的舒适区。

解决方案

在我的情况下,我通过添加到引导实体(运行配置中的Classpath选项卡)解决了这个问题两个条目/ xml-apis /xml-apis/1.4.01/xml-apis-1.4.01.jar和/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar从我的本地maven存储库


I am developing a GWT application in Eclipse and use jdom2 to read some custom xml property files.

Following a recent update my application now fails with the above error when trying to read the xml file. The relevant stack trace is:

org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
org.jdom2.input.sax.XMLReaders.createXMLReader(XMLReaders.java:165)
org.jdom2.input.SAXBuilder.createParser(SAXBuilder.java:871)
org.jdom2.input.SAXBuilder.buildEngine(SAXBuilder.java:854)
org.jdom2.input.SAXBuilder.getEngine(SAXBuilder.java:904)
org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1116)
uk.co.platosys.db.jdbc.DatabaseProperties.loadProperties(DatabaseProperties.java:78)

Researching this problem suggests that the error can arise when incompatible versions of the xerces jars exist on the classpath.

gwt-dev-2.6.1.jar contains the xerces packages and my hunch is that this latest version of gwt-dev has bundled a version that is incompatible. However jdom2.0.5, the current release, is released with the 2.11 version of Xerces which seems to be the latest released by Apache. Putting these jars on my classpath doesn't seem to resolve matters; I have previously been able to rely on the versions in gwt-dev.

I am rather at my wits' end about this and considerably out of my comfort zone.

解决方案

In my case I resolved this issue by adding to bootstrap entities (Classpath tab in run configuration) two entries /xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar and /xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar from my local maven repository

这篇关于ClassCastException:org.apache.xerces.parsers.XIncludeAwareParserConfiguration不能转换为org.apache.xerces.xni.parser.XMLParserConfiguration的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆