Springboot project into a war package, deployed to Tomcat, normal start access error 404

Source: Internet
Author: User

Objective:

Project description, this project is a MAVEN multi-module project, module Project: All (parent module), Util (Common tool Class), DAO (Entity class, Business class, Mapper, Mapper.xml); Business (service service); App-root (is a parent project that contains backend, PC, Mobile, schedule) ...

Structure diagram:

All +--App-root +-   -app-backend   --app-pc   --app-Mobile   --app-  Schedule-- Business-- DAO--Util

Error:

Error description, I put the App-backend project with MAVEN into a war package, uploaded to the production of Tomcat, Tomcat can start normally. However, the visit was reported at 404.

Workaround:

  1. on the startup class of the App-backend project, add the following code:

@Override protected Springapplicationbuilder Configure (Springapplicationbuilder application) {    return Application.sources (appbackendapplication.  Class);}

2, in the App-backend project Pom.xml, modify the following dependencies.

<Dependency>   <groupId>Org.springframework.boot</groupId>   <Artifactid>Spring-boot-starter-web</Artifactid>   <!--Ignore inline tomcat and package deployment to Tomcat. Note * local run time to ignore this paragraph to introduce a comment out, or the project can not start -   <Exclusions>      <exclusion>         <groupId>Org.springframework.boot</groupId>         <Artifactid>Spring-boot-starter-tomcat</Artifactid>      </exclusion>   </Exclusions></Dependency>

Summarize:

I passed the above two steps and the problem was solved. The reason for the error is that the Springboot embedded Tomcat is in conflict with our Tomcat container. I hope I can help the people who have read this article.

Springboot project into a war package, deployed to Tomcat, normal start access error 404

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.