Spring Boot 將jar包釋出方式改為War包

lcc發表於2021-09-09
Spring Boot 將jar包釋出方式改為War包

參考課程 Spring Boot 熱部署

1.修改pom.xml中的jar
    com.imooc
二、問題總結
1. 部署war包報錯
嚴重: The ServletContentInitializer [# Licensed to the Apache Software Foundatio
n (ASF) under one or more] could not be created
java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (
ASF) under one or more
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1713)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1558)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.catalina.startup.ContextConfig.getServletContainerInitiali
zer(ContextConfig.java:1659)
        at org.apache.catalina.startup.ContextConfig.processServletContainerInit
ializers(ContextConfig.java:1569)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1277)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:878)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:369)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5269)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

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

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1655)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)

解決方案1:

提高 tomcat版本

解決方案2:

降低Spring Boot版本,並配置tomcat版本,但是這個會帶來其他一些錯誤,需要逐個解決。

    UTF-8UTF-81.87.0.73<!--配置這裡--&gt

相關文章