JDK11 升级失败 - ClassNotFoundException jdk.internal.ref.Cleaner

JDK11 Upgrade Fails - ClassNotFoundException jdk.internal.ref.Cleaner

我已将 Java EE 应用程序从 JDK 8 升级到 JDK 11。但是当我部署到 JBOSS EAP 7.3 服务器时,我得到了以下异常。

Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: jdk.internal.ref.Cleaner from [Module "deployment.DFNNTPOMS_X_X_3.003.000.00.0.ear" from Service Module Loader]
    at deployment.DFNNTPOMS_X_X_3.003.000.00.0.ear//net.openhft.chronicle.hash.impl.util.CleanerUtils.<clinit>(CleanerUtils.java:42)
    ... 63 more
Caused by: java.lang.ClassNotFoundException: jdk.internal.ref.Cleaner from [Module "deployment.DFNNTPOMS_X_X_3.003.000.00.0.ear" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at deployment.DFNNTPOMS_X_X_3.003.000.00.0.ear//net.openhft.chronicle.hash.impl.util.CleanerUtils.<clinit>(CleanerUtils.java:35)
    ... 63 more

有什么解决办法吗?

您的代码应使用 java.lang.ref.Cleaner 而不是 jdk.internal.ref.Cleaner。后者在 Java 9:

中被删除

如果“内部”Cleaner class 的用法实际上来自第 3 方库代码,那么您需要将库升级到 Java 11 兼容版本.