在tomcat运行时,会有如下报错:
org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60)
解决办法:
1、可能是编译的JDK版本和运行的JDK版本不一致导致
2、如果更换版本解决不了的话,那就修改Tomcat的配置文件。修改如下:
配置文件路径:{tomcat路径}/conf/web.xml
修改内容:在web-app标签中增加metadata-complete="true"(个人建议备份原始文件在做修改)
<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">