java.lang.ClassNotFoundException:org.apache.xml.resolver.readers.CatalogReader
我正在将遗留应用程序从 WildFly 24 更新到 WildFly 26。
不久前,我将此应用程序从 Java 8 转换为 Java 11,所有应用程序都在 WildFly 15 上运行。当时,我使用 module 将一些项目转换为模块化-info.java 文件,但不是全部。
对于应用程序的下一个版本,我升级到 WildFly 24。这相对轻松。该应用程序被搁置了几个月。该版本从未发布,现在我正在更新到 WildFly 26。在此过程中我遇到了一个普遍问题。我的 .ear 应用程序有一些执行 XML 模式解析并使用 XML 目录的代码。这意味着我正在使用以下依赖项:
<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>
在包含 EJB 的项目中,我将它们用作提供的范围,因为 WildFly 具有这些模块。在我的 EAR 项目中,我将依赖项条目添加到清单中:
<archive>
<manifestEntries>
<Dependencies>javax.ws.rs.api, org.dom4j, org.infinispan, org.apache.xml-resolver, org.apache.xerces</Dependencies>
</manifestEntries>
</archive>
当部署我的 .ear
并调用该代码时,我得到以下内容:
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
我尝试过的事情: 为两个现有的内置 Wildfly 模块添加全局模块条目
/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"})
我尝试在 EAR 的 jboss-deployment-struction.xml
中添加条目。我什至尝试将这两个 JAR 的副本添加到 standalone/lib/ext
目录中以使其可用。
WildFly 绝不允许 EAR 和子部署查看这些类。
有什么想法吗?
I'm in the process of updating a legacy application from WildFly 24 to WildFly 26.
Some time ago I converted this application from Java 8 to Java 11 all running on WildFly 15. At the time, I converted some projects to be modularized using module-info.java files, but not all.
For the next version of the application I upgraded to WildFly 24. This was relatively painless. The app got shelved for several months. That version was never released and now I'm updating to WildFly 26. I'm having one general problem in this process. My .ear application has some code that does XML schema parsing and uses an XML catalog. This means I'm using the following dependencies:
<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>
In the project containing the EJBs, I use these as provided scope since WildFly has these modules. In my EAR project, I'm adding Dependencies entry to the manifest:
<archive>
<manifestEntries>
<Dependencies>javax.ws.rs.api, org.dom4j, org.infinispan, org.apache.xml-resolver, org.apache.xerces</Dependencies>
</manifestEntries>
</archive>
When my .ear
is deployed and that code is invoked, I get the following:
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
Things I've tried:
Adding global-modules entries for the two existing built-in wildfly modules
/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've tried adding entries in the jboss-deployment-structure.xml
in the EAR. I've even tried adding copies of the two JARs to the standalone/lib/ext
directory to make them available.
In no way is WildFly allowing the EAR and sub-deployments to see these classes.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论