使用Tomcat 启动war包时报Not running on Jetty, JSR-356 support unavailable 错误 + vue项目发布在tomcat

打成WAR包在TOMCAT启动,报上述错

将JETTY相关依赖注释掉

<!--        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
            <scope>${jetty.scope}</scope>
        </dependency>-->

报以下错

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

查看依赖:

发现TOCMAT相关依赖被exclusion

注释掉

        <!-- spring-boot使用jetty容器配置begin -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

再次运行,启动成功


将vue项目打包npm run build,将打包后的目录复制到springboot项目的static目录下,然后打整个war发布到tomcat


为什么springboot要发布到tomcat 上??

猜你喜欢

转载自blog.csdn.net/qq_24271537/article/details/114891939