Tomcat starts the springboot project war package and reports an error: an error occurred when starting the child

error message

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)
...
严重 [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR 部署 Web 应用程序 archive [/apache-tomcat-9.0.39/webapps/xxxx.war] 时出错
java.lang.IllegalStateException: 启动子级时出错
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:720)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:706)
...

Cause Analysis

It can be seen from the error message that the error "error in opening zip file" has occurred during packaging, so the war package cannot be parsed when tomcat starts.

solution

Delete the war package in the webapps under tomcat, and the folder that has been decompressed (the folder name is the same as the name of the war package), and then repackage. The packaging method is as follows:

  1. Enter the source code folder (the folder where pom.xml is located)
    insert image description here

  2. Press the shift key and the right mouse button, select "Open Powershell window here" or "Open cmd window here" according to the operating system
    insert image description here

  3. Type "mvn clean package" and press Enter to package
    insert image description here

  4. If BUILD SUCCESS appears, it means the packaging is successful

  5. Redeploy to the tomcat container

Guess you like

Origin blog.csdn.net/HPGANG/article/details/115110154