Solve the problem of spring boot + jar packaging deployment tomcat 404 error

Solve the problem of spring boot + jar packaging deployment tomcat 404 error

1. Spring boot does not support jsp jar package, jsp can only be war package.
method:

<packaging>war</packaging>

<build>
 	<plugins>
 		<plugin>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-maven-plugin</artifactId>
 		</plugin>
 	</plugins>
</build>

2. The tomcat version cannot be too new, as it may be unstable. If you use tomcat10, the result will be 404. If you use tomcat9, it will be normal.

The word spring never appears when deployed to tomcat10

The word spring never appears when deployed to tomcat10

Change to tomcat9 and you can see the changes immediately

insert image description here

Successful deployment

insert image description here

This is the end of this article about solving the 404 error problem of spring boot + jar packaging deployment tomcat. For more relevant spring boot + jar packaging deployment tomcat content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • A brief discussion on the implementation principle of SpringBoot embedded Tomcat
  • Solve the problem that SpringBoot webSocket resources cannot be loaded and tomcat startup errors
  • How to install tomcat in docker and deploy the Springboot project war package
  • Solve the problem that Spring boot embedded tomcat does not start
  • A brief discussion on the difference between springboot built-in tomcat and external independent deployment of tomcat
  • SpringBoot2 uses Jetty container operation (replacing the default Tomcat)
  • SpringBoot removes the implementation of embedded tomcat
  • Detailed explanation of the two packaging methods of springboot projects with Tomcat and without Tomcat
  • Tomcat reports an error when starting the springboot project war package: Error when starting the child
  • How to switch the default Tomcat container in Springboot
  • How to remove the embedded Tomcat in Spring Boot and start it in a non-web way

<<:  View the command to modify the MySQL table structure

>>:  Vue/react single page application back without refresh solution

Recommend

A quick solution to the first login failure in mysql5.7.20

First, we will introduce how (1) MySQL 5.7 has a ...

JS implements the rock-paper-scissors game

This article example shares the specific code of ...

Mysql 5.7.17 winx64 installation tutorial on win7

Software version and platform: MySQL-5.7.17-winx6...

JavaScript Dom implements the principle and example of carousel

If we want to make a carousel, we must first unde...

Solve the problem of managing containers with Docker Compose

In Docker's design, a container runs only one...

Will Update in a Mysql transaction lock the table?

Two cases: 1. With index 2. Without index Prerequ...

Two-hour introductory Docker tutorial

Table of contents 1.0 Introduction 2.0 Docker Ins...

Summary of considerations for writing web front-end code

1. It is best to add a sentence like this before t...

Detailed explanation of Vue Notepad example

This article example shares the specific code of ...

Three ways to implement animation in CSS3

This is a test of the interviewee's basic kno...

How to make CSS child elements highly consistent with parent elements

Absolute positioning method: (1) Set the parent e...

Detailed explanation of the use of React.cloneElement

Table of contents The role of cloneElement Usage ...