[axonframework] Perplexing de serialization problem with MongoDB, only happens after initial run

Hi Erich,

my guess is that it is related to the ServiceLoader mechanism. It requires that the class being loaded is an implementation of another type. Mix that in with a touch of class loading, and you get these types of exceptions. Is it possible that your test framework uses a different classloader each time it runs? If so, the second run, the ‘ContentTypeConverter’ is not the same as the first one.

The default “ConverterFactory” that creates all these converters uses the ClassLoader to load the ConverterFactory class to load the other implementations. You could consider using another implementation in your serializer that works around the class loading issue by specifying your own class loader.

Note that this exceptioni is not always an issue. Axon will simply ignore the ByteArrayToInputStream converter in your serializer. Basically, that means your upcasters will not be able to convert Byte Arrays to Inputstreams.