Axon application as Eureka Client

Hello!

As soon as add Eureka Discover Client dependency to my Spring Boot Microservice that uses Axon, the application fails to start due to the following error.

Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'org.axonframework.spring.config.AxonConfiguration'; nested exception is java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, char, java.lang.Object)'

I get this error resolved by adding the following dependency:


com.google.guava
guava
30.1-jre

Just wanted to confirm with the Axon team if this is how it should be fixed or if there is another Axon Spring Boot starter I should use to make my Axon application work as Eureka client?

To make my Axon application Eureka client I use the following Eureka Dependency:

org.springframework.cloud
spring-cloud-starter-netflix-eureka-client

A property in the application.properties file

eureka.client.serviceUrl.defaultZone = http://localhost:8761/eureka

And the @EnableDiscoveryClient annotation above the main application class.

Hi Sergey,

Axon doesn’t use Guava itself, but probably some transient dependencies do. There might be a versioning conflict between these transient dependencies, where the wrong one wins.

I know the grpc-java library uses Guava, and it comes in as a transient dependency via the AxonServer connector.

If you use Maven, you can run mvn dependency:tree to find out which dependencies modules have that may conflict with each other. You can override the version used by explicitly adding the dependency to your own project. Basically just like you did.

Hope this helps.

Thank you, Allard! :+1: