"Invalid Byte Tag in Constant Pool: 15" Exception in Tomcat 7 with Java 8
Tomcat 7 is officially compatible with Java 8. However, when migrating a webapp from Tomcat 7 with Java 6 to another Tomcat 7 server with Java 8, users may encounter the following exception:
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
Possible Causes
This exception occurs due to BCEL (Byte Code Engineering Library) issues in Tomcat 7 with Java 8. BCEL encounters difficulties processing the new Java 8 byte codes, especially when annotation scanning is enabled (metadata-complete="true" in web.xml).
Solutions
No Annotation Scanning:
If annotation scanning is not utilized, the issue can be resolved by updating Tomcat 7 to release 7.0.53 or later, which includes an updated compiler with improved Java 8 support.
Annotation Scanning:
When annotation scanning is enabled, there are two alternatives:
junit.jar,junit-*.jar,ant-launcher.jar,\ jfxrt.jar,nashorn.jar
This will instruct Tomcat to skip scanning the indicated libraries.
Additional Notes:
The above is the detailed content of Why am I Getting \'Invalid Byte Tag in Constant Pool: 15\' Exception in Tomcat 7 with Java 8?. For more information, please follow other related articles on the PHP Chinese website!