Spring boot: Unable to start embedded Tomcat servlet container

后端 未结 8 1398
孤街浪徒
孤街浪徒 2020-12-09 15:26

I\'m new to Spring Boot and having with error while running my application. I\'m following a tutorial and I believe I\'m having proper parent and dependencies with POM, plea

相关标签:
8条回答
  • 2020-12-09 16:00

    You need to Tomcat Dependency and also extend your Application Class from extends SpringBootServletInitializer

    @SpringBootApplication  
    public class App extend SpringBootServletInitializer
    {
        public static void main( String[] args )
        {
            SpringApplication.run(App.class, "hello");
        }
    }
    
    0 讨论(0)
  • 2020-12-09 16:02

    For me, I just had to put a -X flag with mvn. Look at the debug log; there was an issue with Spring while locating the .properties file.

    0 讨论(0)
  • 2020-12-09 16:04

    If you are running on a linux environment, basically your app does not have rights for the default port.

    Try 8181 by giving the following option on VM.

    -Dserver.port=8181

    0 讨论(0)
  • 2020-12-09 16:05

    Try to change the port number in application.yaml (or application.properties) to something else.

    0 讨论(0)
  • 2020-12-09 16:05

    For me, the problem was in XML migrations. I deleted all tables and sequences and it works on next bootRun

    0 讨论(0)
  • 2020-12-09 16:06

    You need to add the tomcat dependency in your pom

    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题