问题描述
错误信息
springboot + spring mvc 的maven项目,在tomcat启动的时候报错,错误信息如下:
SEVERE: Unable to process Jar entry [javassist/util/proxy/SerializedProxy$1.class] from Jar [jar:file:/somr/path/WEB-INF/lib/javassist-3.20.0-GA.jar!/] for annotations
java.io.EOFException
at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340)
at org.apache.tomcat.util.bcel.classfile.Utility.swallowMethodParameters(Utility.java:796)
at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:171)
at org.apache.tomcat.util.bcel.classfile.FieldOrMethod.<init>(FieldOrMethod.java:57)
at org.apache.tomcat.util.bcel.classfile.Method.<init>(Method.java:71)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:267)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:127)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2058)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1934)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1900)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1885)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1317)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
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:5378)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
网友也碰到了这个错误所以,如下:
https://issues.apache.org/jira/browse/WW-4637
https://github.com/jboss-javassist/javassist/issues/29
从评论中找到了一些答案:
1. 升级tomcat
Hi,
Please update to apache-tomcat-7.0.59
I have involved with it too,updating to tomcat-8.0.33,it solved.
所以,将tomcat升级到7.0.59版本以上都可以。
2.修改配置文件
I solve it by adding below to catalina.properties
tomcat.util.scan.DefaultJarScanner.jarsToSkip=javassist-*.jar
3.排除javassist-3.20.0-GA.jar
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
https://tomcat.apache.org/tomcat-8.0-doc/config/jar-scan-filter.html