ClassNotFoundException org.apache.xml.resolver.readers.CatalogReader

784 views
Skip to first unread message

Stephen Sill II

unread,
Apr 1, 2022, 2:44:30 PM4/1/22
to WildFly
Hi all,

I've been taking an application that was targeted at wildfly24 and updating to run on wildfly 26.  I'm having following exception thrown when the application is deployed.  I'm running all this on OpenJDK 11.

There's an ejb that calls some code that reads xml schemas using a catalog.   This same code runs in unit tests perfectly fine.

The two deps related to this are:
            <dependency>
                <groupId>xml-resolver</groupId>
                <artifactId>xml-resolver</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
                <version>2.12.2</version>
            </dependency>

I've verified the .jars end up in the EAR's lib dir.
I've also tried including as provided scope and adding entries to the ear's jboss-deployment-structure to include modules from wildfly itself.
I've even tried including these in the standalone/lib/ext dir.

Any ideas?   
Here's a snippet of the exception.
Caused by: java.lang.ClassNotFoundException: org.apache.xml.resolver.readers.CatalogReader from [Module "org.apache.xerces" version 2.12.0.SP03 from local module loader @20c0a64d (finder: local module finder @455b6df1 (roots: /opt/wf_app/modules,/opt/wf_app/modules/system/layers/base,/opt/wf_app/modules/system/add-ons/ispn))]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)

Stephen Sill II

unread,
Apr 1, 2022, 5:13:56 PM4/1/22
to WildFly
I've also just now tried adding global-modules to make these available
/subsystem=ee:list-add(name=global-modules,value={name=org.apache.xml-resolver,slot="main",meta-inf="true",services="true"})
/subsystem=ee:list-add(name=global-modules,value={name=org.apache.xerces,slot="main",meta-inf="true",services="true"})

I still get
Caused by: java.lang.ClassNotFoundException: org.apache.xml.resolver.readers.CatalogReader from [Module "org.apache.xerces" version 2.12.0.SP03 from local module loader @20c0a64d (finder: local module finder @455b6df1 (roots: /opt/wf_app/modules,/opt/wf_app/modules/system/layers/base))]

    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 80 more

Stephen Sill II

unread,
Apr 3, 2022, 5:09:07 PM4/3/22
to WildFly
I finally did get this to work.  I ended up reworking my projects to completely exclude xml-resolver and xerces and use the xml catalogs via the JAXP classes
As documented here:

I'm going to peel back a few things and see what the minimum number of changes to make this work is.
Reply all
Reply to author
Forward
0 new messages