Invalid byte tag in constant pool: 19 error message

This error message shows that the Tomcat is 8.0.30, and I am using JDK 8. I am creating a Spring-boot project. Some suggested that JDK 8 should be used but I indeed am using JDK 8. What's the problem here?

信息: 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/ 十月 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/ 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/ 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) 

Updated (I want to configure not scanning annotation per suggestions):

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="" xmlns:xsi="" xmlns:context="" xmlns:aop="" xmlns:mvc="" xsi:schemaLocation=" "> <bean factory-method="newFixedThreadPool"> <constructor-arg value="20"></constructor-arg> </bean> <!-- jsf --> <import resource="jsf-context.xml"/> <aop:aspectj-autoproxy proxy-target-class="true"/> <bean> <property name="systemKey" value="com.nlu-qe-service.systemKey"></property> <property name="jvmKey" value="com.nlu-qe-service.jvmKey"></property> </bean> </beans> 
4

4 Answers

Tomcat 8.0 has reached End of Life and should not be used!

The replacement is Tomcat 8.5 (implementing the same specifications as Tomcat 8.0) or Tomcat 9.0 (newer versions of specifications). See "Migration Guide" at tomcat.apache.org.

org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:97)

The BCEL library here is used to parse class files when Tomcat scans for annotations. The version that you are using does not support some features in class file format of Java 8, and thus fails when trying to parse the file.

Your options:

  1. Ignore.
  2. Upgrade Tomcat.
  3. Exclude those jars from annotation scanning. (See the official Tomcat FAQ → Performance → How do I make Tomcat start up faster?).
1

In order to upgrade the tomcat version for the tomcat7-maven-plugin.

<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> 

You can try to downgrade the version of glassfish packages in your dependencies. Had the problem with 2.30.1 version (and Tomcat 8.5 Server), no more issue after changing to 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> 
1

I also got same issue. I just changed aspectjrt and aspectjweaver jar version to

 <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.8.5</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.8.5</version> </dependency> 

Try this one might work for you also.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like