Unable to start embedded tomcat-serveer when I include chaos-monkey profile

117 views
Skip to first unread message

amit aws

unread,
Apr 15, 2021, 4:19:29 PMApr 15
to Chaos Community
Hi 

I'm 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 file
StandardContext.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 errors
AnnotationConfigServletWebServerApplicationContext.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 Tomcat
ThreadPoolTaskScheduler.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 failed
org.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 omitted
Caused 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 omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[/api] failed to start


> Task :bootRun FAILED

Execution failed for task ':bootRun'.
> Process 'command '/Users/e115682/.sdkman/candidates/java/8.0.282.j9-adpt/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

amit aws

unread,
Apr 16, 2021, 8:18:42 PMApr 16
to Chaos Community
Can someone help me please

ersushantsood

unread,
Apr 17, 2021, 11:13:06 AMApr 17
to amit aws, Chaos Community
Hi Amit,
             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 you are using.
  I did a setup in 2019 and it worked fine . I don't have the setup handy with me to check the versions.

Regards
Sushant Sood 
--
You received this message because you are subscribed to the Google Groups "Chaos Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chaos-communi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chaos-community/a2074eea-61fd-417e-bfb2-84e9aea755ban%40googlegroups.com.

amit aws

unread,
Apr 19, 2021, 9:42:30 AMApr 19
to Chaos Community
Thanks a lot for quick response. It worked, After changing the chaos-monkey-spring boot version to the same as spring-boot version.
Also, I'm researching what is the best open source chaos toolkit to run experiments on pcf, I found https://docs.chaostoolkit.org/drivers/cloudfoundry/ but It don't have the assaults I'm looking for such as latency, increase memory usgae of application

Can you please suggest any open source toolkit for pcf


Thanks   

amit aws

unread,
Apr 21, 2021, 10:43:00 AMApr 21
to Chaos Community
can someone help me with above questions?
Reply all
Reply to author
Forward
0 new messages