安全处理org.xml.sax.SAXNotRecognizedException导致Tomcat内部运行java.lang.IllegalStateException的解决方案 [英] Solution for secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException running inside Tomcat

查看:37
本文介绍了安全处理org.xml.sax.SAXNotRecognizedException导致Tomcat内部运行java.lang.IllegalStateException的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在接收Xml并尝试解析它时,我遇到了此异常.作为独立应用程序运行时,负责此工作的代码已经过测试.但是,我现在将其集成到Tomcat中.

I'm facing this exception when receiving an Xml and trying to parse it. The code responsible for that is well tested when running as an standalone application. However I'm now integrating it in Tomcat.

堆栈跟踪为:

java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
    at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:121)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:139)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204)

到处走走,我发​​现,所以也许解决方案是更改Tomcat设置的选项.

Digging around I found this, so maybe the solution is to change the options Tomcat sets.

所以问题是:

  • 问题的根源是什么?
  • 解决问题的最佳方法?
  • 更改Tomcat选项是一种好方法吗?如何完成?

更新

在Java 8上运行时会发生这种情况,恢复到Java 7可以正常工作.

This happens when running it with Java 8, reverting to Java 7 works ok.

推荐答案

我曾经遇到过类似的问题,当xerces jar和xercesImpl jar的版本存在很大差异时,就会发生此问题.为了解决这个问题,我使用了xerces-2.9.0和xercesImpl-2.9.1,问题解决了.

I had faced similar issue, this issue occurs when there is big difference in versions of xerces jar and xercesImpl jar. To solve this, I used xerces-2.9.0 and xercesImpl-2.9.1 and the issue gone.

这篇关于安全处理org.xml.sax.SAXNotRecognizedException导致Tomcat内部运行java.lang.IllegalStateException的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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