NoSuchMethodError: com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar when application packages jaxp impl in JBoss EAP 7

Solution Verified - Updated -

Issue

Application packaging jaxp-ri-2.0.jar (Sun JAXP Implementation classes) is failing when application tries to create new JAXP Schema object with NoSuchMethodError:

java.lang.NoSuchMethodError: com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(Ljavax/xml/transform/Source;)Lcom/sun/org/apache/xerces/internal/xni/grammars/Grammar;
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.NoSuchMethodError: com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(Ljavax/xml/transform/Source;)Lcom/sun/org/apache/xerces/internal/xni/grammars/Grammar;
    at com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(Unknown Source)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
    at com.redhat.examples.servlet.Servlet.init(Servlet.java:53)
...

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 7.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content