jax-rs – SAXNotRecognizedException同时解组XML输入流
发布时间:2020-12-16 23:28:33 所属栏目:百科 来源:网络整理
导读:在尝试解组 XML数据的输入流时,我遇到了这个异常.这显然是Xerces库的一个问题,但我很难找到解决方案.我在带有 Java 8的Glassfish服务器上运行带有 EclipseLink的Java EE程序.我的REST服务中出现这种错误,它将XML输入流作为参数.我得到的错误是: Caused by:
在尝试解组
XML数据的输入流时,我遇到了这个异常.这显然是Xerces库的一个问题,但我很难找到解决方案.我在带有
Java 8的Glassfish服务器上运行带有
EclipseLink的Java EE程序.我的REST服务中出现这种错误,它将XML输入流作为参数.我得到的错误是:
Caused by: java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: unrecognized feature http://javax.xml.XMLConstants/feature/secure-processing at com.sun.xml.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:135) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:154) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:172) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:219) 我已经看到这里发布的其他问题建议升级我正在使用的Xerces库,并让它成为最重要的依赖,所以Maven抓住了那个而不是其他一些库,但它还没有为我做好.我的POM文件的相关部分是: <dependencies> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId> <version>2.22.2</version> <scope>provided</scope> <exclusions> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> <exclusion> <groupId>xerces</groupId> <artifactId>xerces</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.0.2.GA</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>6.0</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>org.dom4j</groupId> <artifactId>dom4j</artifactId> <version>2.0.0-RC1</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>19.0</version> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.14</version> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-csv</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.core</artifactId> <version>2.5.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>3.0.6.RELEASE</version> </dependency> <dependency> <groupId>org.passay</groupId> <artifactId>passay</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-api</artifactId> <version>4.7.4</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.10.19</version> <scope>test</scope> </dependency> <dependency> <groupId>main.java.com.exavault</groupId> <artifactId>evapi</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>org.glassfish.jersey.security</groupId> <artifactId>oauth1-client</artifactId> <version>2.25</version> </dependency> <dependency> <groupId>com.force.api</groupId> <artifactId>force-wsc</artifactId> <version>39.0.0</version> </dependency> <dependency> <groupId>org.mindrot</groupId> <artifactId>jbcrypt</artifactId> <version>0.3m</version> </dependency> </dependencies> 我唯一能想到的仍然是导致问题的是,某些东西仍在使用Xerces库,但我在使用它的依赖项中找不到任何东西.此外,我最初使用xercesImpl版本2.0.2和xerces 2.0.2之前使用xercesImpl 2.11.0,虽然这似乎没有帮助摆脱这个错误. 解决方法
尝试使用xerces-2.9.0和xercesImpl-2.9.1.
参考: Solution for secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException running inside Tomcat (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |