无法启动组件 - ZipException:无效的LOC标头(错误的签名)

时间:2016-12-03 06:53:24

标签: java maven spring-mvc spring-tool-suite

我经历过类似的帖子。我已经尝试了大多数这些解决方案,但无法摆脱我得到的错误。期待一些帮助。

在我将maven dependancies添加到部署程序集后出现此错误。我正在使用STS与Pivotal tc Server Development Edition v3.1。我已经检查了tc服务器和java home的版本。两者都使用java 8。

我无法理解问题所在。

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myProject]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@95e0743]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4850)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4982)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
    ... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@6a44e649]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:111)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:141)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:701)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
    ... 13 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:139)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    ... 16 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at sun.misc.IOUtils.readFully(Unknown Source)
    at java.util.jar.JarFile.getBytes(Unknown Source)
    at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
    at java.util.jar.JarFile.getManifest(Unknown Source)
    at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:137)
    ... 17 more

Dec 03, 2016 10:34:56 AM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor E:\Programs\sts-bundle\pivotal-tc-server-developer-3.2.0.RELEASE\base-instance\conf\Catalina\localhost\myProject.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myProject]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

以下是我的pom.xml。当我尝试将spring-webmvc依赖性添加到pom.xml时出现错误。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.infiniteskills.mvc</groupId>
  <artifactId>myProject</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j13</artifactId>
        <version>1.0.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

  </dependencies>
</project>

2 个答案:

答案 0 :(得分:41)

我通过删除本地maven存储库中存在的所有文件并再次下载它来解决类似的问题。

linux或mac用户可以按照以下步骤删除所有文件。

  1. 导航到.m2文件
  2. 执行remove命令(rm -rf repository /)。

答案 1 :(得分:3)

Nagivate到您的C:\ Users \ user.m2 \ repository \ projects \ project1

选择相应的项目并从.m2中删除它。然后在终端中执行mvn clean install它会为你重新创建那些jar文件在服务器中重新安装ear或war文件,现在它应该部署得很好。