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

How to install Elasticsearch7.6 cluster in docker and set password

Table of contents Some basic configuration About ...

Use VSCode's Remote-SSH to connect to Linux for remote development

Install Remote-SSH and configure it First open yo...

MySql 5.6.35 winx64 installation detailed tutorial

Note: There was no error in the project startup d...

Detailed explanation on how to deploy H5 games to nginx server

On the road to self-learning game development, th...

CSS achieves the effect of two elements blending (sticky effect)

I remember that a few years ago, there was an int...

Linux file system operation implementation

This reading note mainly records the operations r...

Detailed explanation of the setting of background-image attribute in HTML

When it comes to pictures, the first thing we thi...

Solution to MySql service disappearance for unknown reasons

Solution to MySql service disappearance for unkno...

How to view the status of remote server files in Linux

As shown below: The test command determines wheth...

Instructions for using the --rm option of docker run

When the Docker container exits, the file system ...

Markup language - specify CSS styles for text

Click here to return to the 123WORDPRESS.COM HTML ...

Implementation of dynamic rem for mobile layout

Dynamic rem 1. First, let’s introduce the current...

How to purchase and initially build a server

I haven't worked with servers for a while. No...

docker logs - view the implementation of docker container logs

You can view the container logs through the docke...