准备:IntelliJ IDEA 2019.3.5 x64
撰写时间:2021年 6 月 16 日
(很久之前写的忘记发了,当时找了挺多文章才解决的,所以决定记录一下)
遇到一个log4j日志问题,elasticsearch启动报异常:
Unable to process Jar entry……log4j-api-2.11.1.jar!/] for annotations……Invalid byte tag in constant pool: 19 。
导致这个异常是因为我当前使用的JDK版本是1.8, elasticsearch-rest-high-level-client默认添加的log4j是2.11.1,由于log4j版本过高,JDK1.8还无法兼容识别,所以在运行的时候就会出现异常,下面的是完整的异常:
Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:/F:/*****/apache-maven-3.6.3-bin/maven_repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar!/] for annotations
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(Co