• elasticsearch启动报错:Unable to process Jar entry [METAINF/versions/9/moduleinfo.class] from Jar [jar:file:log4japi2.11.1.jar!/] for annotations


    从字面上来说,就是无法处理log4j-api-2.11.1.jar的注解,就是说在当前的开发环境下,elasticsearch包含的log4j-api-2.11.1.jar版本过高了。

    再贴下相信的报错吧:

    严重: Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:/F:/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>(ConstantPool.java:60)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1961)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1319)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

    我的解决方法是,修改pom文件,elasticsearch-rest-high-level-client排除log4j-api,再加上一个低版本的log4j-api,具体代码如下:

    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>6.5.3</version>
        <exclusions>
            <exclusion>
                <artifactId>log4j-api</artifactId>
                <groupId>org.apache.logging.log4j</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.6.2</version>
    </dependency>

    为什么是2.6.2呢?因为我本地最低的log4j-api版本是2.6.2,我从2.11.1开始往下版本替换,只有2.6.2没有报错。

    log4j-api本地仓库

    未经允许不得转载: 技术文章 » Java编程 » elasticsearch启动报错:Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:log4j-api-2.11.1.jar!/] for annotations
  • 相关阅读:
    java 变量的定义 类型转换 基本的数据类型
    Java中的String,StringBuilder,StringBuffer三者的区别?
    Linux配置 ElasticSearch
    Linux 配置 SVN and ideal 配置SVN的客户端 ?
    mysql5.7多实例安装
    MySQL高可用架构之MySQL5.7组复制MGR
    二进制安装MySQL5.6 MySQL5.7
    MySQL主从复制之半同步模式
    MySQL主从复制之异步模式
    基于GTID模式MySQL主从复制
  • 原文地址:https://www.cnblogs.com/roak/p/14329853.html
Copyright © 2020-2023  润新知