1

在启用 CDI(beans.xml)之前,我在 log4j2 的依赖项(LMAX Disruptor)上没有任何 UnsupportedClassVersionError。UnsupportedClassVersionError 告诉在 java9 而不是 java8 上运行,但这不是可选的。请告知如何在 java8 上避免此错误。

Weblogic 12.2 log4j 2.11.2

<May 15, 2019 10:50:00,579 AM SGT> <Error> <Class Loaders> <BEA-2162500> <Class, module-info, was compiled with an incompatible version of Java. Ensure that all the classes needed by the application have been compiled with a compatible java version. java.lang.UnsupportedClassVersionError: module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
java.lang.UnsupportedClassVersionError: module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at weblogic.utils.classloaders.GenericClassLoader.defineClassInternal(GenericClassLoader.java:1113)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:1046)
    Truncated. see log file for complete stacktrace
> 
<May 15, 2019 10:50:00,964 AM SGT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "6752224278283" for task "4" on [partition-name: DOMAIN]. Error is: "weblogic.management.DeploymentException: CDI deployment failure:com/lmax/disruptor/ExceptionHandler"
weblogic.management.DeploymentException: CDI deployment failure:com/lmax/disruptor/ExceptionHandler
    at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:95)
    at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:43)
    at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:39)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:752)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.lmax.disruptor.ExceptionHandler
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
    at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
    Truncated. see log file for complete stacktrace
4

1 回答 1

1

排除 log4j2 CDI 扫描如下:

豆类.xml

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                           http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    version="1.1" bean-discovery-mode="all">
    <scan>
        <!-- Prevent java.lang.NoClassDefFoundError: com/lmax/disruptor -->
        <exclude name="org.apache.logging.**" />
    </scan>
</beans>
于 2019-12-11T02:04:27.523 回答