Thanks for visiting the site !!! Visit below intrested Ads to support us if you like the site .Sharing is caring .keep distance and keep safe . Happy Learning ... 😀

Unable to start embedded Tomcat

trying to implement the chaos monkey in spring boot application  using the “chaos-monkey-spring-boot” library 2.3.9 version
But when I include the “chaos-monkey” in bootRun active profiles
bootRun {
environment SPRING_PROFILES_ACTIVE: environment.SPRING_PROFILES_ACTIVE ?: “chaos-monkey,local”
classpath = sourceSets.test.runtimeClasspath
}

 it is causing below issue
java.lang.NullPointerException: null at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:212) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:823)[/api].class 2021-04-15 14:31:32,275 ERROR[org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/api],THREAD=localhost-startStop-1,]- Exception starting filter [mdcPopulatingFilter]java.lang.NullPointerException: null at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:212) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:823)StandardContext.class 2021-04-15 14:31:32,275 ERROR[org.apache.catalina.core.StandardContext,THREAD=localhost-startStop-1,]- One or more Filters failed to start. Full details will be found in the appropriate container log fileStandardContext.class 2021-04-15 14:31:32,275 ERROR[org.apache.catalina.core.StandardContext,THREAD=localhost-startStop-1,]- Context [/api] startup failed due to previous errorsAnnotationConfigServletWebServerApplicationContext.class 2021-04-15 14:31:32,303 WARN[org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext,THREAD=main,]- Exception encountered during context initialization – cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded TomcatThreadPoolTaskScheduler.class 2021-04-15 14:31:32,305 INFO[org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler,THREAD=main,]- Shutting down ExecutorService ‘chaosMonkeyTaskScheduler’ConditionEvaluationReportLoggingListener.class 2021-04-15 14:31:32,323 INFO[org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener,THREAD=main,]- 
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.SpringApplication.class 2021-04-15 14:31:32,325 ERROR[org.springframework.boot.SpringApplication,THREAD=main,]- Application run failedorg.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) at com.mastercard.alberta.addressservice.AddressServiceApplication.main(AddressServiceApplication.java:42)Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86) at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:417) at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:176) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179)Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) … 8 common frames omittedCaused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[/api] failed to start at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:171) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:110) … 13 common frames omittedCaused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[/api] failed to start

> Task :bootRun FAILED

From the error it seems some issue with the spring dependencies issues. Can you please check the version of spring boot you are using is compatible with the version of chaos monkey spring boot 

It worked, After changing the chaos-monkey-spring boot version to the same as spring-boot version.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *