spring boot idea startup exception

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.



Solution

Think of a problem, will it be because of the scope setting when Intellij integrates maven into the jar package.

Check the pom file carefully and find that the problem may appear in the following two places:

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <version>1.2.3 .RELEASE</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-jasper</artifactId>
      <version>7.0.68</version>
      <scope>provided</scope>
    </dependency>

Comment out the

<scope>provided</scope>

problem in both configurations That's it.

Summary

This may be a bug in Intellij. When using spring-boot, if an imported dependency is set to provided, the corresponding class will not be found when Intellij starts. Therefore, this configuration needs to be commented out at this time, but these dependencies are not needed when packaging is launched, so just open the comments when packaging.

Have encountered the same problem twice, keep in mind!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326316999&siteId=291194637