使用prefer-web-inf-classes时weblogic中的ClassCastException
我必须添加
<prefer-web-inf-classes>true</prefer-web-inf-classes>
到 weblogic.xml 来解决 Hibernate antr 与 Weblogic 的兼容性问题。添加后,我得到了与 XML 解析器相关的所有不同类型的 classCastException。
通过阅读其他线程,我了解到 weblogic 正在尝试使用应用程序所期望的不同类。
我花了一整天的时间研究并尝试了不同的解决方案,例如删除“xml-apis.......”jar 文件。但每次我都会得到 ClassCastException。当我删除 jar 文件时,“from”类的转换会发生变化,但我总是得到
ClassCastException: "some xml parser related class" can not be cast to javax.xml.parsers.DocumentBuilderFactory
有办法知道哪些 xml 解析器 jar 真正导致了问题。
我正在使用 Maven 2 来管理依赖项
I had to add
<prefer-web-inf-classes>true</prefer-web-inf-classes>
to weblogic.xml to resolve a Hibernate antr compatibility issue with Weblogic. after adding that I was getting all different kind of classCastException related to XML parsers.
I understood from reading other threads that weblogic is trying to use a different class that what the application is expecting.
I spend all day researching and tried different solutions like removing "xml-apis......." jar files. but everytime I get ClassCastException. The cast "from" class changes when I remove jar files, but I always get
ClassCastException: "some xml parser related class" can not be cast to javax.xml.parsers.DocumentBuilderFactory
is there a way to know which xml parser jars are really causing the issue.
I m using Maven 2 to manage dependencies
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答我自己的问题:
我通过执行 java 搜索和搜索 Package 并检查“应用程序库”中的搜索,删除了包含 javax.xml.* 包中的类的所有 jar。然后我必须删除 sax..jar 文件。之后一切都按预期进行。
Answering my own question:
I removed all jars that contains classes from javax.xml.* package by doing a java search and searching Package and check search in "application Libraries". then I had to remove sax..jar file. everything worked as expected after that.
对你自己的问题有很好的回答。我还发现了这个方法(如果你使用 Maven),它会生成一个非常好的依赖关系图。我遇到了同样的问题,并且使用依赖关系图,我能够确定有问题的库 xml-apis*.jar 是由 Maven 作为 jasperreports 的依赖项加载的。将排除元素添加到 jasperreports 模块的 pom.xml 中解决了该问题。
http://maven.40175.n5.nabble.com/where-is-xml-apis-1-0-b2-jar-coming-from-td88057.html
Good answer to your own question. I also found this method (if you use maven), which generates a really nice dependency chart. I had this same problem, and using the dependency chart I was able to determine that the offending library, xml-apis*.jar, was loaded by maven as a dependency of jasperreports. Adding the exclusion element to the pom.xml for the jasperreports module fixed the problem.
http://maven.40175.n5.nabble.com/where-is-xml-apis-1-0-b2-jar-coming-from-td88057.html