spring-boot 2.1.9 can used chaos-monkey-spring-boot which version
See original GitHub issueExpected 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=10.1.41.126:9092, 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)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
zipkin2.reporter.ByteBoundedQueue.drainTo(ByteBoundedQueue.java:81)
zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:257)
zipkin2.reporter.AsyncReporter$Builder$1.run(AsyncReporter.java:190)
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)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
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=10.1.41.126:9092, topic=zipkin}},] ProducerConfig values:
acks = 0
batch.size = 16384
bootstrap.servers = [10.1.41.126:9092]
buffer.memory = 33554432
client.id =
compression.type = none
connections.max.idle.ms = 540000
enable.idempotence = false
interceptor.classes = []
key.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer
linger.ms = 0
max.block.ms = 60000
max.in.flight.requests.per.connection = 5
max.request.size = 1048576
metadata.max.age.ms = 300000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
receive.buffer.bytes = 32768
reconnect.backoff.max.ms = 1000
reconnect.backoff.ms = 50
request.timeout.ms = 30000
retries = 0
retry.backoff.ms = 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
sasl.kerberos.service.name = 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
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
transaction.timeout.ms = 60000
transactional.id = null
value.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer
2020-06-10 11:13:42.505 INFO [test-project,AsyncReporter{KafkaSender{bootstrapServers=10.1.41.126:9092, topic=zipkin}},] Kafka version : 2.0.1
2020-06-10 11:13:42.506 INFO [test-project,AsyncReporter{KafkaSender{bootstrapServers=10.1.41.126:9092, 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,]
***************************
APPLICATION FAILED TO START
***************************
Description:
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]
Action:
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: '127.0.0.1:58284', transport: 'socket'
Process finished with exit code 1
Possible Solution
i seed source code in ChaosMonkeyConfiguration.class
@Bean
public ChaosMonkeyScheduler scheduler(
@Nullable TaskScheduler scheduler, ChaosMonkeyRuntimeScope runtimeScope) {
ScheduledTaskRegistrar registrar = null;
if (scheduler != null) {
registrar = new ScheduledTaskRegistrar();
registrar.setTaskScheduler(scheduler);
}
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
- add pom.xml dependency。
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>chaos-monkey-spring-boot</artifactId>
<version>2.3.0-SNAPSHOT</version>
</dependency>
- add program run parameter
--spring.profiles.active=chaos-monkey
- 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:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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。
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.