Axon-3.3.2 - Error configuring Mongo as Event Store

I started building simple example with Axon, using Mongo as EventStorage.

pom:

<dependency>
   <groupId>org.axonframework</groupId>
   <artifactId>axon-spring-boot-starter</artifactId>
   <version>3.3.2</version>
</dependency>
<dependency>
   <groupId>org.springframework.data</groupId>
   <artifactId>spring-data-mongodb</artifactId>
   <version>2.0.8.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
<dependency>
   <groupId>org.springframework.data</groupId>
   <artifactId>spring-data-commons</artifactId>
   <version>2.0.8.RELEASE</version>
</dependency>
<dependency>
   <groupId>org.axonframework</groupId>
   <artifactId>axon-mongo</artifactId>
   <version>3.3.2</version>
</dependency>

Exception:

Hi,

If you don’t have JPA on the classpath, Axon will not create an EventStorageEngine for you. That same level of automation doesn’t exist for MongoDB, so you’ll have to define a bean of type MongoEventStorageEngine in your application context, yourself.

One it find that bean, Axon will generate the EmbeddedEventStore around this implementation.

Kind regards,

Allard

Hi, We are also using Axon Framework with mongodb event store, and my application couldn’t start because of a time out issue while connecting to mongodb servers.

In the same service without axon framework we are able to connect to this mongo instance and add documents to collections. I am not sure may be this is because of the MongoClient. Are may be some dependencies issues. Can i get some help ?

Here is my error stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘__axon-annotation-command-handler-bean-post-processor’: Cannot resolve reference to bean ‘__axon-parameter-resolver-factory’ while setting bean property ‘parameterResolverFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘__axon-parameter-resolver-factory’: Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘axonConfig’: Unsatisfied dependency expressed through field ‘eventStore’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘eventBus’ defined in class path resource [org/axonframework/boot/autoconfig/AxonAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘eventStore’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘eventStorageEngine’: Invocation of init method failed; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches com.mongodb.Mongo$4@283d3628. Client view of cluster state is {type=REPLICA_SET, servers=[{address=serveraddress.local:27020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}, {address=serveraddress.local:27020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}, {address=serveraddress.local:27020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}]

Hi,

it seems your problem is at much lower level than Axon or Mongo: SSLHandshakeException. It seems that you’re using an SSL/TLS connection and that your client and server cannot agree on a protocol. This might be because the JVM doesn’t trust the server’s certificate, or maybe there is no SSL in place, while the client expects it.

Cheers,

Allard