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

时间:2018-10-18 05:20:19

标签: java spring tomcat

此错误消息显示Tomcat是8.0.30,并且我正在使用JDK8。我正在创建一个Spring-boot项目。有人建议应使用JDK 8,但实际上我在使用JDK8。这是什么问题?

信息: 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>

4 个答案:

答案 0 :(得分:4)

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)

当Tomcat扫描注释时,这里的BCEL库用于解析类文件。您使用的版本不支持Java 8的类文件格式的某些功能,因此在尝试解析文件时失败。

您的选择:

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

答案 1 :(得分:0)

我也遇到同样的问题。我只是将Aspectjrt和Aspectjweaver jar版本更改为

//create dt by reading xml string
var xmlString = '<DataTables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://C:/FRM/xsd/DataTables.xsd" ><Table name="dt_EdgeCaseHome"><Header><Column name="Username" type="String" /><Column name="Email" type="String" /><Column name="Password" type="String" /></Header><Row><Value>brian</Value><Value>brianf@edge.com</Value><Value>qwerty</Value></Row></Table><Table name="dt_EdgeCaseSpectrum"><Header><Column name="AppHeader" type="String" /><Column name="UserID" type="String" /><Column name="Service" type="String" /><Column name="Clients" type="String" /></Header><Row><Value>Contract</Value><Value>47</Value><Value>Agent</Value><Value>Exodus</Value></Row><Row><Value>Contract</Value><Value>49</Value><Value>Agent</Value><Value>Prometheus</Value></Row></Table></DataTables>',
xml,

// Create table element
table = document.createElement('table');
table.style.width = '100%';
table.setAttribute('border', '1');
tbdy = document.createElement('tbody');
tr = tbdy.insertRow();
tr.id='header';
// Parse the xml
if (window.DOMParser){ // Standard browsers
    var parser = new DOMParser();
    xml = parser.parseFromString(xmlString, "text/xml");
}
else { // Internet Explorer
    xml = new ActiveXObject("Microsoft.XMLDOM");
    xml.async = false;
    xml.loadXML(xmlString); 
}

var tables = xml.getElementsByTagName("Table");

// for each table
for(var t=0; t<tables.length; t++){
    tableName = tables[t].getAttribute("name");
  console.log(tableName);
  var dtName="dt_EdgeCaseSpectrum";
  if(dtName.match(tableName)){
  // for each table header
    var headers = tables[t].getElementsByTagName("Header");
    var cols = headers[0].childNodes;
    for(var c=0;c<cols.length;c++){
    columnName = cols[c].getAttribute("name");
    td = tr.insertCell();
    td.id=c;
    td.setAttribute('name',columnName);
    td.textContent = columnName;
    console.log(columnName);
    }

    // for each table row
    var rows = tables[t].getElementsByTagName("Row");
    for(var r=0;r<rows.length;r++){
        console.log("row "+r);
      tr = tbdy.insertRow();
      tr.id='iteration_'+r;
        var vals = rows[r].childNodes;
        for(var x=0;x<vals.length;x++){
        value = vals[x].textContent;
      console.log(value);
      td = tr.insertCell();
      td.id=x;
      td.setAttribute('value', value)
      td.textContent = value;
      }
    }
    tbdy.appendChild(tr);
    table.appendChild(tbdy);
    // Append table to the body
    document.body.appendChild(table);
  }
}

尝试这个可能对您也有用。

答案 2 :(得分:0)

为了升级tomcat7-maven-plugin的tomcat版本。

<properties>
    <tomcat7-version>7.0.93</tomcat7-version>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-core</artifactId>
                    <version>${tomcat7-version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

答案 3 :(得分:0)

您可以尝试在依赖项中降级glassfish软件包的版本。 在使用2.30.1版本(和Tomcat 8.5服务器)时出现问题,更改为2.22.2后再没有问题。

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.22.2</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>2.22.2</version>
    </dependency>