exception on event upcasting

Hi everyone,

I am in the process of migrating a few events to a new signature.

The first problem I was confronted with was wiring and triggering the appropriate event upcaster, and I managed to find a solution.

Second, when the upcaster’s ‘upcast(SerializedType)’ method is called, I get an exception, ‘Cannot build a converter to convert from [B to project.SkillAdded’.

I am unable to understand (so far) why the input type is interpreted as ‘[B’. I am also trying to figure out how to wire and trigger the converter. So far, I have seen that one requirement is to inherit AbstractContentTypeConverter<S,T>.

As a side note, I am wondering if anyone can point me to some examples/tutorials regarding upcasters & converters (I have read the documentation but I find it very terse).

Thanks a lot in advance.

Hi Răzvan,

upcasters work on a so-called “intermediate representation”. They don’t work directly on your Event classes themselves, for the very simple reason that the upcasters typically need to make changes to the stored data structure, before it can be mapped to the event classes.
The intermediate representations that you can use depend on the type of serializer that you use. byte[] is always possible. If you use an XStreamSerializer, you can use Dom4J documents, for example. If you have a JacksonSerializer, you can use JSON documents as intermediate representation.

Axon will automatically convert between different representations. In your case, you upcaster says is uses “SkillAdded” as intermediate representation. The exception indicates that Axon doesn’t know how to convert from byte[] (which is how events are stored) to SkillAdded. Instead of the latter, you probably want to use Dom4J Document, or something similar.

Kind regards,


Hi Allard,

Thanks… Razvan helped me out here and we found how to fix this.
The next version of scynapse will contain Converters todo upcasting based on the ‘standard’ scala-xml. (automatically registered)