Tomcat 7 + Java 8 : Invalid byte tag in constant pool: 15

Just upgraded to Java 8, and the Tomcat 7 keeps prompting the following exceptions:


Jul 20, 2015 4:06:36 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [jdk/nashorn/internal/objects/NativeURIError.class] from Jar [jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/nashorn.jar!/] for annotations
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>(ConstantPool.java:60)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2066)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1942)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1908)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1893)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1296)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:346)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Tested :

  1. Tomcat 7.0.29
  2. Java 1.8.0_45
  3. Spring 4 MVC web application

Previously, it was working fine on Java 1.7.0_05

Solution

Not sure what is the reason, to fix it, just upgrade Tomcat to the latest version, for example Tomcat 7.0.65.

Tested with success :

  1. Tomcat 7.0.65
  2. Java 1.8.0_45
  3. Spring 4 MVC web application

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
5 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
Rajesh RajagopaltomtruongabhiroopAlberto Cabello SánchezDiego Manuel Benitez Enciso Recent comment authors
newest oldest most voted
Diego Manuel Benitez Enciso
Guest
Diego Manuel Benitez Enciso

Excelente!

Alberto Cabello Sánchez
Guest
Alberto Cabello Sánchez

The reason is a Tomcat bug, fixed in 7.0.30:
https://bz.apache.org/bugzilla/show_bug.cgi?id=53735

abhiroop
Guest
abhiroop

I’m using tomcat-9.0.7.B.RELEASE still facing same problem

tomtruong
Guest
tomtruong

I am still facing this same problem with Tomcat version 7.0.70 (and java version “1.8.0_161” on Mac).

However, this problem became non-fatal after I follow the below helpful suggestion:
https://coderanch.com/t/618223/java/JAXWS-tomcat-java-lang-NoClassDefFoundError

BTW, thanks for a great example ws app!

Rajesh Rajagopal
Guest
Rajesh Rajagopal

If you are mixing lower version of Spring framework (<4) with Java 8 Lambda expression this error comes. Upgrade Spring or remove Java 8 features.