Axon MongoDB Extension with Jackson Snapshot configuration

Hello I try to configure MongoDB Extension with Jackson.

I used the wallet show case for it. GitHub - marzelwidmer/axon-wallet: Based on :

The Application works fine with the XSteam Settings. and also When I configure the MongoDB eventSerializer with Jackson.

I have issues when I configure the snapshotSerializer also with my Jackson Settings.

Question : Can I mix this ?

and have maybe somebody any idea how to fix this ?

     * Create a Mongo based Event Storage Engine.
    fun storageEngine(client: MongoClient?): EventStorageEngine = MongoEventStorageEngine.builder()

    // But for all our messages we'd prefer the JacksonSerializer due to JSON's smaller format
    fun jacksonMessageSerializer(): Serializer {
        val objectMapper = ObjectMapper()
            .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
        return JacksonSerializer.builder()

    fun messageSerializer(): Serializer = XStreamSerializer.builder()

    fun xStream(): XStream {
        val xStream = XStream()
        return XStreamSerializer.builder().xStream(xStream).build().xStream

org.axonframework.eventsourcing.IncompatibleAggregateException: Aggregate identifier must be non-null after applying an event. Make sure the aggregate identifier is initialized at the latest when handling the creation event.
	at org.axonframework.eventsourcing.EventSourcedAggregate.publish( ~[axon-eventsourcing-4.5.9.jar:4.5.9]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	*__checkpoint ⇢ Handler ch.keepcalm.axon.wallet.api.WalletCommandController#createWallet(Continuation) [DispatcherHandler]
	*__checkpoint ⇢ org.springframework.web.filter.reactive.ServerWebExchangeContextFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ HTTP GET "/command/create" [ExceptionHandlingWebHandler]
Original Stack Trace:

Hi Marzel,

I tried to move the demo project included in the extension to Jackson. I think I ran into the same problem there. With Jackson you need public getters to serialize private fields. So hopefully adding those to WalletAggregate should fix it. Please let us know if that helps.

1 Like