camunda-community-hub / camunda-8-benchmark

Helper to create benchmarks for Camunda Platform 8 and Zeebe
21 stars 8 forks source link

SpringBoot/Docker - APPLICATION FAILED TO START #59

Closed MaLub closed 1 year ago

MaLub commented 1 year ago

Starting current main version (either per mvn locally or per docker) results to an error

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method jobWorkerManager in io.camunda.zeebe.spring.client.AbstractZeebeBaseClientSpringConfiguration required a single bean, but 2 were found:
        - benchmarkStartPiExceptionHandlingStrategy: defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/org/camunda/community/benchmarks/BenchmarkStartPiExceptionHandlingStrategy.class]
        - benchmarkCompleteJobExceptionHandlingStrategy: defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/org/camunda/community/benchmarks/BenchmarkCompleteJobExceptionHandlingStrategy.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
berndruecker commented 1 year ago

Thanks for reporting @MaLub - is this a blocker for you? We plan to adjust the auto configuration mechanism of Spring Zeebe allowing a better control over which beans are loaded or not (https://github.com/camunda-community-hub/spring-zeebe/issues/275) - so I would love to wait for this before looking into this specifically.

MaLub commented 1 year ago

Hello @berndruecker thank you for your reply. No it doesn't block me. I've fixed it this way: (set @Primary-Annotation)

@Component
@Primary
public class BenchmarkStartPiExceptionHandlingStrategy extends DefaultCommandExceptionHandlingStrategy  {

I've run in the next problem and have to set the default.worker-name in application.properties

zeebe.client.worker.default-name="foo"

Know it works for me :)

falko commented 1 year ago

@Primary workaround is now merged in the main branch (see c199ff9). Once camunda-community-hub/spring-zeebe#275 is done we can remove it again.

berndruecker commented 1 year ago

I looked at this now and just realized, that the problem is that there are actually two beans of the same type WITHIN the benchmark project - a situation Spring Zeebe is not built to support - at least at the moment. So I think @Primary should be OK for now here - I just would add it on the JobCompletion one in this case - as this would be used by Spring Zeebe if nothing else is defined. But it should not make any difference any way