Spring Boot Error : Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory


Problem Use case:
While starting a Spring Boot Application using

mvn spring-boot:run

The Application fails to start
Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

Exception Details [Truncated]:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) on project Javaexp-springboot-rest: An exception occurred while running. null: InvocationTargetException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Solution
Update pom.xml and use the spring-boot-starter-web

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   <version>1.5.9.RELEASE</version>
</dependency>
Now do a new build and the application should be able to start.

Comments

Popular posts from this blog

Difference between volatile and synchronized

Converting Java Map to String

Masking Credit Card number in Java