• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.  RSS feed

 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Experts,

I am trying to convert a spring framework to Spring Boot web app but keeps getting the error below.



2018-06-15 19:12:49.234  INFO 4124 --- [           main] e.i.d.S.IntegratedSpringApplication      : Starting IntegratedSpringApplication on DESKTOP-1KGGO27 with PID 4124 (C:\Users\\IntegratedSpringDemo\target\classes started by in C:\Users\\IntegratedSpringDemo)
2018-06-15 19:12:49.259  INFO 4124 --- [           main] e.i.d.S.IntegratedSpringApplication      : No active profile set, falling back to default profiles: default
2018-06-15 19:12:49.515  INFO 4124 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2f05be7f: startup date [Fri Jun 15 19:12:49 SGT 2018]; root of context hierarchy
2018-06-15 19:12:53.847  INFO 4124 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$2611bd2a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-15 19:12:54.037  WARN 4124 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
2018-06-15 19:12:54.121  INFO 4124 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-06-15 19:12:54.158 ERROR 4124 --- [           main] o.s.b.SpringApplication                  : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at com.abc.demo.SpringBootWebApp.IntegratedSpringApplication.main(IntegratedSpringApplication.java:23) [classes/:?]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:204) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
... 8 more



I have searched the web and added in the necessary annotation as follows :



I am using Tomcat as external server and has removed the embedded Tomcat in my pom.xml.

Here's is my pom.xml



I hope someone can tell me what is wrong cos I have been trying very hard to figure out for the past few hours but to no avail.....

Tks.
 
Sheriff
Posts: 21325
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you exclude the embedded Tomcat dependencies? Without those or a replacement, there is no internal web server. Just include them. you should also remove the servlet-api and jsp-api dependencies, Spring Boot provides them (through Tomcat). I'm not sure about jstl though.
 
and POOF! You're gone! But look, this tiny ad is still here:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!