war 打包后tomcat部署运行出错(tomcat外置)

Blade 未结 0 156
58219040
58219040 剑童 2023-08-19 10:39

一、该问题的重现步骤是什么?

  1. maven依赖

    图片1.png

2. pom文件修改打包类型为war

图片2.png

3.添加war包插件

图片3.png

4.修改启动类

截图_20230818210426.png


二、你期待的结果是什么?实际看到的又是什么?

期待结果:打包成功后的war包,放到tomcat中可以运行

实际:打包成功后放到tomcat运行失败

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

spring-boot版本3.1.1  win10系统    jdk8  tomcat8.5

四、请提供详细的错误堆栈信息,这很重要。

19-Aug-2023 10:37:37.023 严重 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 

org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/blade-api]]

at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:710)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:687)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:750)

Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.util.modeler.Registry.disableRegistry()V

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)

at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4925)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

... 10 more

Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.modeler.Registry.disableRegistry()V

at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:192)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)

... 21 more

19-Aug-2023 10:37:37.030 严重 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR 部署 Web 应用程序 archive [D:\develop\apache-tomcat-8.5.91\webapps\blade-api.war] 时出错

java.lang.IllegalStateException: 启动子级时出错

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:714)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:687)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:750)

Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/blade-api]]

at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:710)

... 9 more

Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.util.modeler.Registry.disableRegistry()V

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)

at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)

at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4925)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

... 10 more

Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.modeler.Registry.disableRegistry()V

at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:192)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)

... 21 more

五、若有更多详细信息,请在下面提供。

论坛上的几个方法都试了都不行

回答
  • 消灭零回复
提交回复