tomcat啟動報錯java.util.zip.ZipException:invalidCENheader(badsignature)
war包部署到tomcat裡,啟動時報錯:
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@7e21e65f]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:699)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 14 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid CEN header (bad signature)
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:139)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 17 more
Caused by: java.util.zip.ZipException: invalid CEN header (bad signature)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.jar.JarFile.<init>(JarFile.java:152)
at java.util.jar.JarFile.<init>(JarFile.java:89)
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:136)
... 18 more
根據ZipException報錯,懷疑是jar包有損壞。
為了定位是哪個jar包,使用下面shell指令碼,用jar命令測試jar包:
cd WEB-INF/lib/
for j in *.jar; do echo $j; jar tvf $j > /dev/null ; echo $j done; done
正常的jar包只列印出jar的檔名,損壞的jar包會列印出錯誤資訊
aspectjweaver-1.6.9.jar
java.util.zip.ZipException: invalid CEN header (bad signature)
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.zip.ZipFile.<init>(ZipFile.java:126)
at sun.tools.jar.Main.list(Main.java:1115)
at sun.tools.jar.Main.run(Main.java:293)
at sun.tools.jar.Main.main(Main.java:1288)
從maven倉庫中刪除這個jar,重新maven打包。
另外,遇到 invalid LOC header (bad signature) 錯誤,
用jar tvf命令就檢查不出來了。可以使用unzip -t命令檢測。
for j in *.jar; do echo $j; unzip -t $j > /dev/null ; if [ $? -ne 0 ]; then echo $j error; fi; echo $j done; done
mysql-connector-java-5.1.27.jar
warning [mysql-connector-java-5.1.27.jar]: 317386 extra bytes at beginning or within zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 317386
(attempting to re-compensate)
mysql-connector-java-5.1.27.jar error
相關文章
- tomcat-啟動報錯Multiple Contexts have a path of "/xxxx"TomcatContext
- Tomcat啟動報錯:Error starting static Resources解決方法TomcatError
- maven外掛 tomcat7啟動報錯,異常如下MavenTomcat
- Tomcat啟動時Initializing Spring FrameworkServlet 'springmvc'卡住,並且不報錯TomcatFrameworkServletSpringMVC
- 報錯com.android.build.api.transform.TransformException: java.util.zip.ZipException:AndroidUIAPIORMExceptionJava
- Tomcat啟動後頁面可以正常訪問 介面路徑報錯404Tomcat
- myeclipse啟動報錯Eclipse
- tomcat釋出報錯Tomcat
- 解決啟動Tomcat報錯:Failed to destroy end point associated with ProtocolHandler["ajp-nio-8009"]TomcatAIProtocol
- 本地nacos啟動報錯
- Homestead 啟動 elasticsearch 報錯Elasticsearch
- SpringBootApplication是如何啟動Tomcat的? | 破解SpringBoot Tomcat啟動之謎 !Spring BootAPPTomcat
- 解決啟動openfeign報錯
- laravel sail 首次啟動報錯LaravelAI
- Mac 上啟動 appium 報錯MacAPP
- apache啟動報錯:httpd: aprApachehttpd
- 解決Tomcat啟動報錯問題:Failed to destroy end point associated with ProtocolHandler["ajp-nio-8009"]TomcatAIProtocol
- tomcat 啟動失敗Tomcat
- tomcat 報錯 java.lang.OutOfMemoryErroTomcatJava
- mongodb啟動報錯怎麼辦MongoDB
- Xcode啟動RN報錯"`fsevents` unavailable"XCodeAI
- Centos7啟動Nginx報錯。CentOSNginx
- Redis 啟動報錯Address already in useRedis
- nginx 啟動報錯 unknown directive "server"NginxServer
- 深入淺出Tomcat/2 - Tomcat啟動和停止Tomcat
- Tomcat啟動流程簡析Tomcat
- Linux下Tomcat重新啟動LinuxTomcat
- 關閉tomcat報錯Cannot allocate memoryTomcat
- 測試類啟動報錯缺失servletWebServerApplicationContextServletWebServerAPPContext
- zabbix-server啟動報錯解決Server
- sshd啟動報錯Could not load host key
- Tomcat原始碼分析--啟動流程Tomcat原始碼
- 9. 啟動、關閉tomcatTomcat
- 在linux下啟動tomcat命令LinuxTomcat
- 如何在linux下啟動tomcatLinuxTomcat
- solr搜尋報錯,tomcat maxHttpHeaderSize 設定SolrTomcatHTTPHeader
- 解決 Rust WebAssembly 啟動 Web 程式報錯RustWeb
- 使用root使用者啟動hadoop報錯Hadoop