Illegal provider-class name: http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl when application packages jaxp implementation in JBoss EAP 7
Environment
Red Hat JBoss Enterprise Application Platform (EAP) 7.1
Issue
Application packaging jaxp-ri-2.0.jar (Sun JAXP Implementation classes) is failing when application tries to create new JAXP SchemaFactory object with Illegal provider-class name: http://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl:
javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
...
Caused by: javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created
at javax.xml.validation.SchemaFactoryFinder.findServiceProvider(SchemaFactoryFinder.java:362)
at javax.xml.validation.SchemaFactoryFinder._newFactory(SchemaFactoryFinder.java:219)
at javax.xml.validation.SchemaFactoryFinder.newFactory(SchemaFactoryFinder.java:146)
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:213)
at com.redhat.examples.servlet.Servlet.init(Servlet.java:52)
...
Caused by: java.util.ServiceConfigurationError: javax.xml.validation.SchemaFactory: vfs:/content/packaged-xml-parsers.war/WEB-INF/lib/jaxp-ri-2.0.jar/META-INF/services/javax.xml.validation.SchemaFactory:1: Illegal provider-class name: http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.fail(ServiceLoader.java:245)
at java.util.ServiceLoader.parseLine(ServiceLoader.java:272)
at java.util.ServiceLoader.parse(ServiceLoader.java:307)
at java.util.ServiceLoader.access$200(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at javax.xml.validation.SchemaFactoryFinder$2.run(SchemaFactoryFinder.java:351)
at javax.xml.validation.SchemaFactoryFinder$2.run(SchemaFactoryFinder.java:347)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.validation.SchemaFactoryFinder.findServiceProvider(SchemaFactoryFinder.java:347)
... 29 more
...
Resolution
The jaxp implementation jar contains an invalid entry in jaxp-ri-2.0.jar/META-INF/services/javax.xml.validation.SchemaFactory. The services file is not a properties file, it should just contain the class name of the factory implementation.
Change this file from:
http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl
To
com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl
Root Cause
Invalid META-INF/services/javax.xml.validation.SchemaFactory
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.