java – 解決 Invalid byte tag in constant pool: 19

最近在做log4j升級到log4j2的時候遇到了Invalid byte tag in constant pool: 19的問題

上網查了一下,有網友遇到過相似的情況,這個問題的原因是有些jar中增加了jdk9特性Module,Package,在這些包中可以找到module-info.class,其jdk版本號也對應1.9

而tomcat啟動時,會嘗試解析這些類,解析到module-info.class時,導致了報錯

解決辦法是建議將tomcat升級到最新版本相對的jdk也要升級,例如 tomcet 9.0 jdk1.8

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.<init>(ConstantPool.java:55)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:176)
	at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:85)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2042)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1988)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1958)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1912)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1157)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *