Thursday, February 17, 2022

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.


 .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v2.4.8)


2022-02-17T19:41:33,738 [main] INFO c.n.c.i.r.c.RunClaas - Starting RunClaas using Java 1.8.0_162 on N-5CG5091JBX with PID 50680 (C:\myorg-cache_New\cache\implementation\myorg-cachecache-nova-Interface\target\classes started by hsk in C:\ICE_New\myorg-cache-cache\implementation\myorg-cachecache-nova-Interface)

2022-02-17T19:41:33,757 [main] INFO c.n.c.i.r.c.RunClaas - No active profile set, falling back to default profiles: default

2022-02-17T19:41:34,313 [main] ERROR 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:162) ~[spring-boot-2.4.8.jar:2.4.8]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) [spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) [spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) [spring-boot-2.4.8.jar:2.4.8]

at com.nokia.cemod.test.rest.controller.RunClaas.main(RunClaas.java:10) [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:209) ~[spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.4.8.jar:2.4.8]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.8.jar:2.4.8]

... 9 more

Fix

1)application.properties
Add
spring.main.web-application-type=none

2)Ensure @SpringBootApplication is used 

@SpringBootApplication
public class RunClaas {
public static void main(String[] args) {
SpringApplication.run(target.class,arg)
}

Troubleshooting Docker Image Format: Ensuring Docker v2 Instead of OCI

  Troubleshooting Docker Image Format: Ensuring Docker v2 Instead of OCI Introduction While working with Docker 27+ , I encountered an iss...