Tomcat 异常: Unable to process Jar entry [module-info.class] from Jar
严重: Unable to process Jar entry [module-info.class] from Jar [jar:file:/D:/repository/mvn_repository/org/projectlombok/lombok/1.18.18/lombok-1.18.18.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)
复制代码
现象描述
SpringMVC 测试案例, 在 tomcat 的 maven 插件中启动报错, 但是访问页面没有问题.
原因
报错原因是由于 maven 依赖之间的版本冲突引起
解决方案:
1, 找到版本冲突的 jar, 例如当前案例,提示是: [jar:file:/D:/repository/mvn_repository/org/projectlombok/lombok/1.18.18/lombok-1.18.18.jar!/]
2, 在 pom 文件中, 给该依赖加上作用域 <scope>provided</scope>, 限制当前 jar 的使用范围即可
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<scope>provided</scope>
</dependency>
复制代码
该 jar 不会在运行时参与, 所以也就不会和 tomcat 发生冲突了, 从而解决冲突.
评论