Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spring-boot 2.1.9 can used chaos-monkey-spring-boot which version

See original GitHub issue

Issue Description

Expected Behavior

pass my test,spring-boot 2.1.9 project only can used chaos-monkey-spring-boot version is 2.0.0、2.0.1、2.0.2,can‘t used version is 2.1.1、2.2.0 and 2.3.0-SNAPSHOT.

Why support spring-boot 2.1.9 in 2.0.2 after version ?

Current Behavior

when i used 2.1.1 and after version, will thrown exception

2020-06-10 11:13:41.594 ERROR [test-project,main,] Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'chaosMonkeyRestEndpoint' defined in class path resource [de/codecentric/spring/boot/chaos/monkey/configuration/ChaosMonkeyConfiguration.class]: Unsatisfied dependency expressed through method 'chaosMonkeyRestEndpoint' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scheduler' defined in class path resource [de/codecentric/spring/boot/chaos/monkey/configuration/ChaosMonkeyConfiguration.class]: Unsatisfied dependency expressed through method 'scheduler' parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.scheduling.TaskScheduler' available: expected single matching bean but found 2: taskScheduler,catalogWatchTaskScheduler
2020-06-10 11:13:41.632  INFO [test-project,main,] Stopping service [Tomcat]
2020-06-10 11:13:41.650  WARN [test-project,main,] The web application [ROOT] appears to have started a thread named [AsyncReporter{KafkaSender{bootstrapServers=, topic=zipkin}}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
2020-06-10 11:13:41.650  WARN [test-project,main,] The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
2020-06-10 11:13:41.653  WARN [test-project,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
2020-06-10 11:13:42.501  INFO [test-project,AsyncReporter{KafkaSender{bootstrapServers=, topic=zipkin}},] ProducerConfig values: 
	acks = 0
	batch.size = 16384
	bootstrap.servers = []
	buffer.memory = 33554432 = 
	compression.type = none = 540000
	enable.idempotence = false
	interceptor.classes = []
	key.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer = 0 = 60000 = 5
	max.request.size = 1048576 = 300000
	metric.reporters = []
	metrics.num.samples = 2
	metrics.recording.level = INFO = 30000
	partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
	receive.buffer.bytes = 32768 = 1000 = 50 = 30000
	retries = 0 = 100
	sasl.client.callback.handler.class = null
	sasl.jaas.config = null
	sasl.kerberos.kinit.cmd = /usr/bin/kinit
	sasl.kerberos.min.time.before.relogin = 60000 = null
	sasl.kerberos.ticket.renew.jitter = 0.05
	sasl.kerberos.ticket.renew.window.factor = 0.8
	sasl.login.callback.handler.class = null
	sasl.login.class = null
	sasl.login.refresh.buffer.seconds = 300
	sasl.login.refresh.min.period.seconds = 60
	sasl.login.refresh.window.factor = 0.8
	sasl.login.refresh.window.jitter = 0.05
	sasl.mechanism = GSSAPI
	security.protocol = PLAINTEXT
	send.buffer.bytes = 131072
	ssl.cipher.suites = null
	ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
	ssl.endpoint.identification.algorithm = https
	ssl.key.password = null
	ssl.keymanager.algorithm = SunX509
	ssl.keystore.location = null
	ssl.keystore.password = null
	ssl.keystore.type = JKS
	ssl.protocol = TLS
	ssl.provider = null = null
	ssl.trustmanager.algorithm = PKIX
	ssl.truststore.location = null
	ssl.truststore.password = null
	ssl.truststore.type = JKS = 60000 = null
	value.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer

2020-06-10 11:13:42.505  INFO [test-project,AsyncReporter{KafkaSender{bootstrapServers=, topic=zipkin}},] Kafka version : 2.0.1
2020-06-10 11:13:42.506  INFO [test-project,AsyncReporter{KafkaSender{bootstrapServers=, topic=zipkin}},] Kafka commitId : fa14705e51bd2ce5
2020-06-10 11:13:42.518  INFO [test-project,kafka-producer-network-thread | producer-1,] Cluster ID: nvkI2fgER1CCkbc3dB2DTQ
2020-06-10 11:13:42.528  INFO [test-project,main,] [Producer clientId=producer-1] Closing the Kafka producer with timeoutMillis = 9223372036854775807 ms.
2020-06-10 11:13:42.554  INFO [test-project,main,] 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-10 11:13:42.566 ERROR [test-project,main,] 



Parameter 0 of method scheduler in de.codecentric.spring.boot.chaos.monkey.configuration.ChaosMonkeyConfiguration required a single bean, but 2 were found:
	- taskScheduler: defined by method 'taskScheduler' in class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.class]
	- catalogWatchTaskScheduler: defined by method 'catalogWatchTaskScheduler' in class path resource [org/springframework/cloud/consul/discovery/ConsulDiscoveryClientConfiguration.class]


Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

Disconnected from the target VM, address: '', transport: 'socket'

Process finished with exit code 1

Possible Solution

i seed source code in ChaosMonkeyConfiguration.class

  public ChaosMonkeyScheduler scheduler(
      @Nullable TaskScheduler scheduler, ChaosMonkeyRuntimeScope runtimeScope) {
    ScheduledTaskRegistrar registrar = null;
    if (scheduler != null) {
      registrar = new ScheduledTaskRegistrar();
    return new ChaosMonkeyScheduler(registrar, assaultProperties, runtimeScope);

in this code, this statement of method , is compatible scheduler parameter is null,why add @Nullable annotation。

Steps to Reproduce

  1. add pom.xml dependency。
  1. add program run parameter
  1. start project

Context (Environment)

os: macOS 10.15.3 JDK: 1.8.0_231-b11 spring-boot: 2.1.9 spring-cloud : 2.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

liquanjincommented, Jun 11, 2020

Hi, @WtfJoke . Thank your reply 。

Your reply given me some idea to fix this question。

At this same time,i think this question:chaos-monkey-spring-boot depend TaskScheduler Bean,Why chaos-monkey-spring-boot can’t configure a TaskScheduler Bean by myself,But rely on external TaskScheduler Bean。

I think defined a TaskScheduler Bean by myself is best way to fix this question。

maiksensicommented, Jun 22, 2020

hey @liquanjin, this seems answered. If you have other questions, feel free to ask them on stackoverflow as we tend to use that for questions regarding the usage. If you think your issue is a bug, please open a new one, and we can discuss the details there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chaos Monkey for Spring Boot Reference Guide - GitHub Pages
Each Chaos Monkey version is built for a specific Spring Boot version, which can be found on the release page. Chaos Monkey might...
Read more >
Chaos Engineering & Chaos Monkey for Spring Boot ...
In this blog we will explore Chaos Monkey and see how it can be used to launch attacks on a Spring Boot App....
Read more >
Releases · codecentric/chaos-monkey-spring-boot - GitHub
Contribute to codecentric/chaos-monkey-spring-boot development by creating an ... #329 #330 #331 Upgrade to Spring Boot 2.7.6 and bump dependencies versions ...
Read more >
Developing resilient SpringBoot/JVM applications with Chaos ...
In layman terms this step unleashes the monkey to create chaos in your application. Spring Boot Chaos Monkey uses reflections to inject failures ......
Read more >
Failed to bind properties under 'chaos.monkey.assaults' to de ...
After adding choas Money Application start throwing "nAPPLICATION FAILED TO START" error. Springbot version :
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found