猿问

常量池中的字节标记无效:19 错误消息

这个错误信息显示Tomcat是8.0.30,我使用的是JDK 8。我正在创建一个Spring-boot项目。有人建议应该使用 JDK 8,但我确实在使用 JDK 8。这里有什么问题?


信息: Starting Servlet Engine: Apache Tomcat/8.0.30

十月 18, 2018 12:26:19 下午 org.apache.catalina.startup.HostConfig deployDescriptor

信息: Deploying configuration descriptor /home/export/Domains/nluqe.jd.com/server1/conf/Catalina/localhost/ROOT.xml

十月 18, 2018 12:26:19 下午 org.apache.catalina.core.StandardContext setPath

警告: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []

十月 18, 2018 12:26:32 下午 org.apache.catalina.startup.ContextConfig processAnnotationsJar

严重: Unable to process Jar entry [module-info.class] from Jar [jar:file:/home/export/App/nluqe.jd.com/WEB-INF/lib/lombok-1.16.22.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:55)

at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:176)

at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:85)

at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2011)

at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1961)

at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1936)

at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1897)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1149)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)


拉丁的传说
浏览 263回答 3
3回答

慕莱坞森

为了升级tomcat7-maven-plugin的tomcat版本。<properties>&nbsp; &nbsp; <tomcat7-version>7.0.93</tomcat7-version></properties><build>&nbsp; &nbsp; <plugins>&nbsp; &nbsp; &nbsp; &nbsp; <plugin>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.tomcat.maven</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>tomcat7-maven-plugin</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>2.2</version>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <dependencies>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.tomcat.embed</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>tomcat-embed-core</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>${tomcat7-version}</version>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dependencies>&nbsp; &nbsp; &nbsp; &nbsp; </plugin>&nbsp; &nbsp; </plugins></build>

忽然笑

您可以尝试降级依赖项中的 glassfish 包的版本。2.30.1 版本(和 Tomcat 8.5 服务器)有问题,改成 2.22.2 后不再有问题。&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.glassfish.jersey.core</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>jersey-client</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <version>2.22.2</version>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; <groupId>org.glassfish.jersey.media</groupId>&nbsp; &nbsp; &nbsp; <artifactId>jersey-media-json-jackson</artifactId>&nbsp; &nbsp; &nbsp; <version>2.22.2</version>&nbsp; &nbsp; </dependency>

当年话下

Tomcat 8.0 已结束生命周期,不应使用!替代品是 Tomcat 8.5(实现与 Tomcat 8.0 相同的规范)或 Tomcat 9.0(规范的更新版本)。请参阅 tomcat.apache.org 上的“迁移指南”。org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:97)这里的BCEL库用于Tomcat扫描注解时解析class文件。您使用的版本不支持 Java 8 类文件格式的某些功能,因此在尝试解析文件时失败。您的选择:忽略。升级Tomcat。从注释扫描中排除这些 jar。(请参阅官方 Tomcat FAQ → 性能 → 如何让 Tomcat 启动得更快?)。
随时随地看视频慕课网APP

相关分类

Java
我要回答