Hi,
I’m new to Axon and trying to figure out how to make MongoDB the storage for the event sources and also how to use RabbitMQ. I found different examples on web and trying to combine them but I keep getting the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'axonJsonSerializer' defined in class path resource [com/Ultimatesoftware/IntegrationServices/Commands/config/AxonConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.axonframework.serialization.Serializer]: Factory method 'axonJsonSerializer' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/datatype/jsr310/JSR310Module
below is configuration file that i’m using to define mongodbTemplate:
@Configuration
public class AxonConfig {
@Value("${mongodb.url}")
private String mongoUrl;
@Value("${mongodb.port}")
private int mongoPort;
@Value("${mongodb.dbname}")
private String mongoDbName;
@Value("${mongodb.events.collection.name}")
private String eventsCollectionName;
@Value("${mongodb.events.snapshot.collection.name}")
private String snapshotCollectionName;
@Bean
public Serializer axonJsonSerializer() {
return new JacksonSerializer();
}
@Bean
public EventStorageEngine eventStorageEngine(){
return new MongoEventStorageEngine(
axonJsonSerializer(),null, axonMongoTemplate(), new DocumentPerEventStorageStrategy());
}
@Bean(name = "axonMongoTemplate")
public MongoTemplate axonMongoTemplate() {
MongoTemplate template = new DefaultMongoTemplate(mongoClient(), mongoDbName, eventsCollectionName, snapshotCollectionName);
return template;
}
@Bean
public MongoClient mongoClient(){
MongoFactory mongoFactory = new MongoFactory();
mongoFactory.setMongoAddresses(Arrays.asList(new ServerAddress(mongoUrl)));
return mongoFactory.createMongo();
}
}
and here is the code I have in the main application file: