基於module-info.class的問題

module-info.class問題

1.module-info.class是個什麼?幹什麼?

2.看名字module-info,即模塊信息,自然想到是管理模塊信息的。jdk9特性裡的,在解壓軟件中直接幹掉唄,試試沒報錯ok就行

3.pom文件導入 asm等配置後啟動報錯

        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
            <version>3.3.1</version>
        </dependency>

嚴重:

Unable to process Jar entry [module-info.class] from Jar [jar:file:/D:/soft/repository/org/ow2/asm/asm/7.1/asm-7.1.jar!/] for annotations
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19

log4j中也有,也幹掉,這個層次jar位置再往下找META-INF/versions/9/module-info.class,編譯器都告訴你位置瞭,別傻傻的和前面那個一樣

 Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:/D:/soft/repository/org/apache/logging/log4j/log4j-api/2.12.0/log4j-api-2.12.0.jar!/] for annotations

找到對應maven倉庫的位置 /D:/soft/repository/org/apache/logging/log4j/log4j-api/2.12.0/log4j-api-2.12.0.jar!/下的

META-INF/versions/9/module-info.class  解壓工具刪除掉(關掉IDE工具,刪完再運行)

Tomcat報錯module-info.class

Tomcat報錯[module-info.class] from Jar [file:/S:/Environment/apache-tomcat-8.5.11/wtpwebapps/huibang/WEB-INF/lib/jaxb-api-2.3.1.jar] for annotations:

十一月 11, 2020 10:48:50 上午 org.apache.catalina.startup.ContextConfig processAnnotationsJar
嚴重: Unable to process Jar entry [module-info.class] from Jar [file:/S:/Environment/apache-tomcat-8.5.11/wtpwebapps/huibang/WEB-INF/lib/jaxb-api-2.3.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:97)
    at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:54)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:174)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:83)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2053)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2000)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1970)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1923)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1163)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    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)

十一月 11, 2020 10:48:51 上午 org.apache.catalina.startup.ContextConfig processAnnotationsJar
嚴重: Unable to process Jar entry [module-info.class] from Jar [file:/S:/Environment/apache-tomcat-8.5.11/wtpwebapps/huibang/WEB-INF/lib/stax-ex-1.8.jar] for annotations
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19

以第一個報錯為例

processAnnotationsJar
嚴重: Unable to process Jar entry [module-info.class] from Jar [file:/S:/Environment/apache-tomcat-8.5.11/wtpwebapps/huibang/WEB-INF/lib/jaxb-api-2.3.1.jar] for annotations

找到Maven下的jar包

在這裡插入圖片描述

查看jar包所在路徑

在這裡插入圖片描述

找到並刪除它

在這裡插入圖片描述

以上為個人經驗,希望能給大傢一個參考,也希望大傢多多支持WalkonNet。

推薦閱讀: