Tomcat 7 - Servlet 3.0: Invalid byte tag in constant pool

mtyson picture mtyson · Jul 19, 2011 · Viewed 98.3k times · Source
  • tomcat 7.0.16
  • Java 1.6.0_22
  • CentOS 5.6

I just switched the web.xml to servlet 3.0 (from a app running 2.4 previously) and now I'm seeing the following error (turned on fine logging for org.apache.tomcat.util):

mtyson  FINE: Scanning JAR [file:/usr/java/jdk1.6.0_22/jre/lib/ext/jcharset.jar] from classpath
mtyson  Jul 19, 2011 10:04:40 AM org.apache.catalina.startup.HostConfig deployDirectory
mtyson  SEVERE: Error deploying web application directory ROOT
mtyson  org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60

UPDATE: Just Tried tomcat 7.0.19 - same results

Answer

KeithM picture KeithM · Oct 4, 2012

Adding

metadata-complete="true" 

to your web.xml should sort the issue

<web-app version="3.0"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         metadata-complete="true">

This tells tomcat not to scan classes for annotations: http://www.tomcatexpert.com/blog/2011/10/12/how-use-fragments-and-annotations-configure-your-web-application