java - 常量池中的无效字节标记 : 19 error message

标签 java spring tomcat

此错误信息显示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)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1777)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
十月 18, 2018 12:26:34 下午 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/log4j-api-2.10.0.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)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1777)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

已更新(我想根据建议配置不扫描注释):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <bean id="executorService" class="java.util.concurrent.Executors" factory-method="newFixedThreadPool">
        <constructor-arg value="20"></constructor-arg>
    </bean>

    <!-- jsf -->
    <import resource="jsf-context.xml"/>


    <aop:aspectj-autoproxy proxy-target-class="true"/>


    <bean class="com.jd.ump.annotation.JAnnotation">

        <property name="systemKey" value="com.nlu-qe-service.systemKey"></property>

        <property name="jvmKey" value="com.nlu-qe-service.jvmKey"></property>
    </bean>


    </beans>

最佳答案

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扫描注解时解析类文件。您使用的版本不支持 Java 8 类文件格式的某些特性,因此在尝试解析文件时失败。

您的选择:

  1. 忽略。
  2. 升级 Tomcat。
  3. 从注释扫描中排除这些 jar。 (请参阅官方 Tomcat 常见问题解答 → 性能 → 如何让 Tomcat 启动得更快?)。

关于java - 常量池中的无效字节标记 : 19 error message,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48994453/

相关文章:

java - 在 Selenium Webdriver 中处理多页表

java - 使用日历在每个午夜重置计算的步数

spring - 事务如何与多个 DAO 一起工作,想了解单个连接如何共享

java - Server Stop responding because of [Pool-Cleaner] :Tomcat Connection Pool but has failed to stop it. 这很可能造成内存泄漏

tomcat - ./startup.sh : command not found error

java - Spring Boot 2.0.0 M7 更新后,@Query 中未读取 SpEL

Java练习: Printing asterisks Triangle and its inverted triangle using recursion method

spring - JPA 通过多条件查找

java - JAX-WS 网络服务的 JSON 输出?

Tomcat7 加载server.xml 失败