java.util.zip.ZipException: invalid LOC header (bad signature)

Posted --->别先生<---

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.util.zip.ZipException: invalid LOC header (bad signature)相关的知识,希望对你有一定的参考价值。

1:部署好项目,启动tomcat出现如下所示的错误,百度方法,挺多的,但是好像并没有解决我的问题,问题如下所示:

 1 java.util.zip.ZipException: invalid LOC header (bad signature)
 2     at java.util.zip.ZipFile.read(Native Method)
 3     at java.util.zip.ZipFile.access$1400(Unknown Source)
 4     at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
 5     at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
 6     at java.util.zip.InflaterInputStream.read(Unknown Source)
 7     at org.apache.catalina.loader.WebappClassLoaderBase.findResourceInternal(WebappClassLoaderBase.java:3521)
 8     at org.apache.catalina.loader.WebappClassLoaderBase.findResource(WebappClassLoaderBase.java:1458)
 9     at org.apache.catalina.loader.WebappClassLoaderBase.getResourceAsStream(WebappClassLoaderBase.java:1686)
10     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2272)
11     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2262)
12     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2280)
13     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2262)
14     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2280)
15     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2262)
16     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2280)
17     at org.apache.catalina.startup.ContextConfig.populateJavaClassCache(ContextConfig.java:2262)
18     at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2168)
19     at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2120)
20     at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1981)
21     at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1942)
22     at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1927)
23     at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1332)
24     at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:888)
25     at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
26     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
27     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
28     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5522)
29     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
30     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
31     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
32     at java.util.concurrent.FutureTask.run(Unknown Source)
33     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
34     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
35     at java.lang.Thread.run(Unknown Source)
36 
37 二月 18, 2018 5:26:40 下午 org.apache.catalina.loader.WebappClassLoaderBase findResourceInternal
38 严重: Resource read error: Could not load junit/framework/TestCase.class.

2:解决方法如下所示,以及问题分析:

原因如下所示,出现如下所示,是因为下载没有下载完整。所以删除了这个包,从新使用maven下载即可:

 

使用如下所示maven工具进行下载即可:

 然后使用toncat启动项目即可;主要分析是那个包出现来下载异常,然后解决即可;

以上是关于java.util.zip.ZipException: invalid LOC header (bad signature)的主要内容,如果未能解决你的问题,请参考以下文章