在添加Consul作为发现代理后,我正在尝试部署一个spring-boot微服务。问题是在我添加了maven依赖性和Spring注释之后。现在不能再部署WAR文件了,错误消息如下:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
...
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@47bffd1]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
...
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 16 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:110)
... 17 more
...
2-Dec-2018 12:23:38.846 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /xxxx/apache-tomcat-8.5.6_DEV_xxx-Input-Management/webapps/xxxx-Input-Management
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/xxxx-Input-Management]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
我的pom.xml是:
<!-- PARENT POM -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/>
</parent>
<!-- /PARENT POM -->
<!-- POM -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- Dependencies -->
<!-- Other Dependencies -->
<!-- /Other Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<!-- /Dependencies -->
<!-- /POM -->
应用程序在本地(嵌入式tomcat(中使用此配置可以很好地工作,服务已注册,但当我部署它时,它们会崩溃,在没有Consul的情况下,它甚至在服务器中也可以工作。
其他信息:-Tomcat:8.5.6-弹簧:2.1.1.释放
当您的jar文件损坏时可能会发生此错误,请确保您的jar没有损坏。同时尝试清理您的项目/tomcat目录。
看看这个,也许它会给你指明正确的方向:java.util.zip zip异常