0

我正在将应用程序从 java 1.4 迁移到 1.7,

我遇到的运行时错误之一是类转换异常:

java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to org.apache.crimson.tree.XmlDocument

代码:

doc = getDocBuilder().parse(inputSource); // returning DeferredDocumentImpl
((XmlDocument) doc).changeNodeOwner(rootElement); // casting Exception here

是否有任何解决方法可以围绕这两种类型进行转换?

4

0 回答 0