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

Posted 香吧香

tags:

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

  记录下最近遇到的一些记录的东西:

  项目中引用消息中间件,pom文件中添加了依赖,并maven-update,maven-install等,项目启动之后,一直报下面的异常。

Could not index class org/apache/activemq/artemis/api/jms/ActiveMQJMSClient.class at 
    /D:/wildfly820Final_2/standalone/deployments/fucdn-admin.war/WEB-INF/lib/windq-artemis-jms-client-2.4.0-BETA9.jar: 
    java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method) [rt.jar:1.8.0_181]
    at java.util.zip.ZipFile.access$1400(Unknown Source) [rt.jar:1.8.0_181]
    at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source) [rt.jar:1.8.0_181]
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source) [rt.jar:1.8.0_181]
    at java.util.zip.InflaterInputStream.read(Unknown Source) [rt.jar:1.8.0_181]
    at java.io.BufferedInputStream.fill(Unknown Source) [rt.jar:1.8.0_181]
    at java.io.BufferedInputStream.read1(Unknown Source) [rt.jar:1.8.0_181]
    at java.io.BufferedInputStream.read(Unknown Source) [rt.jar:1.8.0_181]
    at java.io.DataInputStream.readFully(Unknown Source) [rt.jar:1.8.0_181]
    at java.io.DataInputStream.readFully(Unknown Source) [rt.jar:1.8.0_181]
    at org.jboss.jandex.Indexer.verifyMagic(Indexer.java:433) [jandex-1.2.1.Final.jar:1.2.1.Final]
    at org.jboss.jandex.Indexer.index(Indexer.java:689) [jandex-1.2.1.Final.jar:1.2.1.Final]
    at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:100) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_181]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_181]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_181]

17:37:05,015 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."fucdn-admin.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."fucdn-admin.war".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment "fucdn-admin.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_181]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_181]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_181]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018741: Failed to get manifest for deployment "/D:/wildfly820Final_2/standalone/deployments/fucdn-admin.war/WEB-INF/lib/windq-artemis-jms-client-2.4.0-BETA9.jar"
    at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.getManifest(ManifestAttachmentProcessor.java:78) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:65) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    ... 5 more

 

  这个主要的异常提示是:

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

这个主要由于引用的maven依赖文件在maven仓库没有下载成功,需要将maven仓库中对应的文件删除之后重新下载。
如果不删除,一直maven-update或maven-install可能不会下载成功,会一直报该异常

 

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