记录一次tomcat问题排查记录:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19

最近项目升级jdk,从jdk7 升级到 jdk8,本地已经自测完成了,需要部署到测试环境,测试环境已经装好 jdk8 了,但是tomcat 的版本还是 7。不过,据我之前了解,tomcat7是可以运行JDK8编译的web工程的,只要tomcat的运行环境的JDK是1.8即可。但是不能有比JDK1.8还要新的特性。所以最终决定不升级 tomcat 版本。

等我把项目部署到 测试环境 tomcat 下后,项目是可以跑起来的且能正常运行,但是在项目启动过程中,报了一堆错:

SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/home/.......(中间省略)....../WEB-INF/lib/jakarta.ws.rs-api-2.1.5.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:136)
    at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:59)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:208)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:118)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2055)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1931)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1897)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1882)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1314)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
    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)

报错的不仅这一条,有很多条,分别对应不同的jar包。

我在网上苦寻解决方案,找到和实践过的方案包括下面几个:

修改web.xml 加 metadata-complete="true": https://www.cnblogs.com/ning-blogs/p/4480438.html
升级aspectjweaver的依赖: https://blog.csdn.net/guoshengkai373/article/details/53404830
升级单个jar: https://www.cnblogs.com/wxylog/p/9721332.html

这些方案,对应解决我的问题都不行,我一度产生了升级 tomcat 版本的想法,但最终我还是找到了解决方案。

参考:https://blog.csdn.net/JackRen_Developer/article/details/82288488

最终解决方案是: 修改 tomcat\conf\catalina.properties,tomcat.util.scan.DefaultJarScanner.jarsToSkip 节点增加 相应 的 jar,然后重启tomcat。

就这样,没有升级tomcat版本,问题解决。

原文地址:https://www.cnblogs.com/klbc/p/12025002.html

时间: 2024-08-28 22:04:01

记录一次tomcat问题排查记录:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19的相关文章

tomcat部署新的项目的时候出现报错信息: Invalid byte tag in constant pool: 15

上面一堆tomcat启动的提示信息省略掉,下面是报错的具体信息:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131) at org.apache.tomcat.util.bcel.classfi

tomcat部署新的项目启动时出现报错信息: Invalid byte tag in constant pool: 15

...... org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(C

org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java .class file

org.apache.tomcat.util.bcel.classfile.ClassFormatException: null is not a Java .class file 在$TOMCAT_HOME/conf/catalina.properties文件 的tomcat.util.scan.DefaultJarScanner.jarsToSkip中添加DB2驱动的Jar包文件名如”db2jcc4.jar” 即可.

org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file

Tomcat启动时输出以下错误: 24-May-2015 14:47:07.441 SEVERE [localhost-startStop-1] org.apache.catalina.startup.ContextConfig.processAnnotationsJar Unable to process Jar entry [com/auth/spring/listener/SpringLoaderListener.class] from Jar [jar:file:/opt/apache-

Tomcat 部署 The APR based Apache Tomcat Native ...

Tomcat启动时提示org.apache.catalina.core.AprLifecycleListener- ApacheTomcatJavaJNIIE 网上针对此问题提供的文章很多,但多数和我遇到的情况有出入,所以我将其记录于此 最近开发中需要使用Tomcat,随意找来个较新的版本6.0.20就用.发现启动时提示: "2010-5-12 18:06:06 org.apache.catalina.core.AprLifecycleListener init 信息: The APR base

访问不到主页index.jsp的原因是servlet-api.jar包有冲突,删除lib的servlet-api.jar,如果报错则添加Apache Tomcat下的 servlet-api.jar 即可。

HTTP Status 500 - Unable to compile class for JSP: type Exception report message Unable to compile class for JSP: description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperE

项目抛弃Tomcat容器,用代码启动Tomcat插件

tomato启动代码如下: package tomcat; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; /** * The Class StartMainTomcat. * * @author nibili */ public class StartTomcat { /** The Constant PORT. */ public static final i

How to Install Apache Tomcat 8.5 on CentOS 7.3

How to Install Apache Tomcat 8.5 on CentOS 7.3 From: https://www.howtoforge.com/tutorial/how-to-install-tomcat-on-centos/ This tutorial exists for these OS versions CentOS 7.3 CentOS 7 On this page Step 1 - Install Java (JRE and JDK) Step 2 - Configu

window下安装Apache Tomcat

window下Apache Tomcat安装 1.下载Apache Tomcat 打开:http://tomcat.apache.org/,根据需要下载对应版本 我选择下载相应windows版本的Tomcat 9 2.解压,进入到对应目录 了解一下Tomcat下各个文件及文件夹的意义: bin:二进制执行文件.里面最常用的文件是startup.bat,如果是 Linux 或 Mac 系统启动文件为 startup.sh. conf:配置目录.里面最核心的文件是server.xml.可以在里面改端