Xerces与JBOSS EAP 7.1一起使用时XSD 1.1验证失败

问题描述 投票:0回答:1

我的Web应用程序已部署在JBOSS EAP 7.1服务器中,并使用jdk 1.8。我需要使用以下xerces依赖性针对XSD 1.1验证我的XML:

<dependency>
        <groupId>org.opengis.cite.xerces</groupId>
        <artifactId>xercesImpl-xsd11</artifactId>
        <version>2.12-beta-r1667115</version>
</dependency>

我的验证代码在独立运行时工作正常。但是,当我在JBOSS服务器上部署Web应用程序时,相同的代码在以下行中失败。

SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1");

我遇到以下错误:

javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created

如何使用xerces验证JBOSS EAP 7.1中的XSD 1.1版本?

java xerces jboss-eap-7 xsd-1.1
1个回答
0
投票

尝试使用this constructor,它使用工厂的类名称。工厂的类是“ org.apache.xerces.jaxp.validation.XMLSchema11Factory”,您还需要在类路径上使用“ xercesImpl-xsd11-2.12-beta-r1667115.jar”。

© www.soinside.com 2019 - 2024. All rights reserved.