简体   繁体   English

类Cast异常:com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

[英]Class Cast exception: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

I'm struck with a problem in jboss. 我对jboss中的一个问题感到震惊。 When I try to deploy my .war into the server, I get this following error, 当我尝试将我的.war部署到服务器时,我得到以下错误,

java.lang.ClassCastException: com.sun.org.apache.xerces.internal.jaxp.SAXParserF actoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory

from which, it is quite evident that there is a clash of libraries. 从中可以看出,图书馆存在冲突。 So, I removed the jar file which contains xerces, which happened to by jaxp-ri-1.4.1.jar. 所以,我删除了包含xerces的jar文件,这是由jaxp-ri-1.4.1.jar发生的。 Now, when I try to re-deploy, I get this new error, 现在,当我尝试重新部署时,我收到了这个新错误,

java.lang.NullPointerException
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:944)
    at org.apache.commons.digester.Digester.parse(Digester.java:1765)
    at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java

where it is complaining that it can't find the xml parsers. 抱怨它无法找到xml解析器。

So, now my questions is that does anybody know what can be a solution. 那么,现在我的问题是,是否有人知道什么是解决方案。 Any jaxp jar file that doesn't contain the xerces package? 任何不包含xerces包的jaxp jar文件?

Update 更新

I did as suggested here and now I have a new error, 我按照这里的建议做 ,现在我有一个新的错误,

java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl

which is a class from one of the jars I deleted which contains SaxParserFactory :( 这是我删除的其中一个包含SaxParserFactory的罐子的类:(

It appears that you've deleted the wrong JAR. 您似乎删除了错误的JAR。 The original ClassCastException was reported when an instance of SAXParserFactoryImpl (which is a subtype of SAXParserFactory) is being cast to SAXParserFactory. 当SAXParserFactoryImpl的实例(它是SAXParserFactory的子类型)被强制转换为SAXParserFactory时,会报告原始的ClassCastException。

The exception is more likely to be due to the fact that there are two instances of SAXParserFactory rather than two instances of SAXParserFactoryImpl being loaded in the JVM. 该异常更可能是由于SAXParserFactory有两个实例,而不是在JVM中加载了两个SAXParserFactoryImpl实例。 At the time of casting, the SAXParserFactory loaded by a different classloader was returned resulting in the exception. 在转换时,返回由不同类加载器加载的SAXParserFactory导致异常。 The fix therefore is to identify JARs in your classpath that have conflicting versions of SAXParserFactory. 因此,修复是在类路径中标识具有冲突版本的SAXParserFactory的JAR。 Removing the parser implementation itself might not be wise, if Commons Digester is looking for a particular implementation. 如果Commons Digester正在寻找特定的实现,那么删除解析器实现本身可能并不明智。

I'm guessing... You're using JBoss 5.1. 我猜...你正在使用JBoss 5.1。 If so then it's xml parser and classloading issue. 如果是这样,那么它是xml解析器和类加载问题。 You must define jboss-classloading.xml 您必须定义jboss-classloading.xml

See http://www.coderanch.com/t/523519/JBoss/Cast and http://www.mastertheboss.com/jboss-application-ser...oss-5-classloading-issues.html http://www.coderanch.com/t/523519/JBoss/Casthttp://www.mastertheboss.com/jboss-application-ser...oss-5-classloading-issues.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ClassCastException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl无法转换为javax.xml.parsers.DocumentBuilderFactory - ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory 找不到错误org.apache.xerces.jaxp.DocumentBuilderFactoryImpl - Error org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl - java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl java.lang.ClassNotFoundException:org / apache / xerces / jaxp / DocumentBuilderFactoryImpl - java.lang.ClassNotFoundException: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl java.lang.ClassCastException: class com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to class - java.lang.ClassCastException: class com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to class mongodb:无法实例化com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl。 使用工厂方法创建的Bean - mongodb : Failed to instantiate com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl. Bean created using factory method java.lang.ClassCastException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl无法强制转换为javax.xml.parsers.DocumentBuilderFactory - java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory com.sun.org.apache.xerces.internal.dom.DocumentImpl无法转换为org.codehaus.plexus.util.xml.Xpp3Dom - com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to org.codehaus.plexus.util.xml.Xpp3Dom com.sun.org.apache.xerces.internal.dom.ElementImpl的替代方案 - Alternative to com.sun.org.apache.xerces.internal.dom.ElementImpl Java XML: ClassCastException class com.sun.org.apache.xerces.internal.dom.DeferredTextImpl cannot be cast to class javax.swing.text.Element - Java XML: ClassCastException class com.sun.org.apache.xerces.internal.dom.DeferredTextImpl cannot be cast to class javax.swing.text.Element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM