欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Tomcat启动springboot项目war包报错:启动子级时出错的问题

程序员文章站 2022-04-05 13:10:36
今天公司springboot项目准备部署到测试服务器上进行测试,打包好war后放到tomcat里面启动后,前端文件能访问到,但是接口请求一直是404,一直找了很久的原因,tomcat启动是成功的,wa...

今天公司springboot项目准备部署到测试服务器上进行测试,打包好war后放到tomcat里面启动后,前端文件能访问到,但是接口请求一直是404,一直找了很久的原因,tomcat启动是成功的,war打包的时候也提示build success了,tomcat启动日志发现报错:

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:705)
  at org.apache.catalina.startup.hostconfig.deploywar(hostconfig.java:978)
  at org.apache.catalina.startup.hostconfig$deploywar.run(hostconfig.java:1848)
  at java.util.concurrent.executors$runnableadapter.call(unknown source)
  at java.util.concurrent.futuretask.run(unknown source)
  at org.apache.tomcat.util.threads.inlineexecutorservice.execute(inlineexecutorservice.java:75)
  at java.util.concurrent.abstractexecutorservice.submit(unknown source)
  at org.apache.catalina.startup.hostconfig.deploywars(hostconfig.java:773)
  at org.apache.catalina.startup.hostconfig.deployapps(hostconfig.java:427)
  at org.apache.catalina.startup.hostconfig.start(hostconfig.java:1576)
  at org.apache.catalina.startup.hostconfig.lifecycleevent(hostconfig.java:309)
  at org.apache.catalina.util.lifecyclebase.firelifecycleevent(lifecyclebase.java:123)
  at org.apache.catalina.util.lifecyclebase.setstateinternal(lifecyclebase.java:423)
  at org.apache.catalina.util.lifecyclebase.setstate(lifecyclebase.java:366)
  at org.apache.catalina.core.containerbase.startinternal(containerbase.java:936)
  at org.apache.catalina.core.standardhost.startinternal(standardhost.java:841)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1384)
  at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1374)
  at java.util.concurrent.futuretask.run(unknown source)
  at org.apache.tomcat.util.threads.inlineexecutorservice.execute(inlineexecutorservice.java:75)
  at java.util.concurrent.abstractexecutorservice.submit(unknown source)
  at org.apache.catalina.core.containerbase.startinternal(containerbase.java:909)
  at org.apache.catalina.core.standardengine.startinternal(standardengine.java:262)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.core.standardservice.startinternal(standardservice.java:421)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.core.standardserver.startinternal(standardserver.java:930)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.startup.catalina.start(catalina.java:738)
  at sun.reflect.nativemethodaccessorimpl.invoke0(native method)
  at sun.reflect.nativemethodaccessorimpl.invoke(unknown source)
  at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)
  at java.lang.reflect.method.invoke(unknown source)
  at org.apache.catalina.startup.bootstrap.start(bootstrap.java:342)
  at org.apache.catalina.startup.bootstrap.main(bootstrap.java:473)
 caused by: org.apache.catalina.lifecycleexception: 初始化组件[org.apache.catalina.webresources.jarresourceset@67d48005]失败。
  at org.apache.catalina.util.lifecyclebase.handlesubclassexception(lifecyclebase.java:440)
  at org.apache.catalina.util.lifecyclebase.init(lifecyclebase.java:139)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:173)
  at org.apache.catalina.webresources.standardroot.startinternal(standardroot.java:726)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.core.standardcontext.resourcesstart(standardcontext.java:4792)
  at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:4928)
  at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:183)
  at org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:717)
  ... 37 more
 caused by: java.lang.illegalargumentexception: java.util.zip.zipexception: error in opening zip file
  at org.apache.catalina.webresources.abstractsinglearchiveresourceset.initinternal(abstractsinglearchiveresourceset.java:143)
  at org.apache.catalina.util.lifecyclebase.init(lifecyclebase.java:136)
  ... 44 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>(unknown source)
  at java.util.zip.zipfile.<init>(unknown source)
  at java.util.jar.jarfile.<init>(unknown source)
  at java.util.jar.jarfile.<init>(unknown source)
  at org.apache.tomcat.util.compat.jrecompat.jarfilenewinstance(jrecompat.java:221)
  at org.apache.tomcat.util.compat.jrecompat.jarfilenewinstance(jrecompat.java:206)
  at org.apache.catalina.webresources.abstractsinglearchiveresourceset.initinternal(abstractsinglearchiveresourceset.java:140)
  ... 45 more

一直在关注:启动子级时出错,找了很久没有解决!后面关注到下面的zip错误问题,然后再回去考虑打包的问题,终于发现打包的时候出现了问题,虽然最后是build success,但是前面提示了有error没注意到,截图如下:

Tomcat启动springboot项目war包报错:启动子级时出错的问题

这就是问题所在,怎么解决的呢?

解决方法:将报错的jar包从maven仓库中删除掉,然后重新下载打包,发现这一次没有报错error,然后扔到tomcat里面启动没有错误日志了,访问也正常了!

谨以此文章记录提醒以后自己多关注一下项目执行、打包等过程和日志等!

总结

到此这篇关于tomcat启动springboot项目war包报错:启动子级时出错的问题解决方案的文章就介绍到这了,更多相关tomcat启动springboot项目war包报错内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!