org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19

/WEB-INF/lib/log4j-api-2.10.0.jar!/] 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.(ConstantPool.java:55)
        at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:177)
        at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:85)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2089)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1965)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1931)
        at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1916)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5412)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
        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)

这个问题是tomcat版本过低报的错误,由于开发的tomcat版本高于部署的tomcat版本,所以你部署的时候会遇见这个错误。

解决办法:

方法一:将当前的tomcat7升级至高版本tomcat8。

方法二:将当前的tomcat7的tomcat\conf\catalina.properties文件,节点增加log4j-api-2.10.0.jar,然后重新启动tomcat,问题解决。(其实目的就是设置tomcat扫描时忽略这个jar包)

tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
log4j-api-2.10.0.jar
正在加载评论...