Where I am going wrong?
Your problem lies with XStream, as you can see from the exception.
XStream has seen some CVE's flying about a couple of months back, which required its de-/serialization approach to turn 180 degrees.
Instead of taking an entire reflective approach to understanding how to de-/serialize an object, XStream now requires you to tell which classes it may serialize.
Axon regarded the XStreamSerializer
as a decent default for any application because it was capable of de-/serializing everything. However, the above made this infeasible and required some changes on the end of the serializer.
Those changes have been released in Framework 4.5.4, for which you can find the release notes here.
What you can spot in the notes is that the framework tries to provide an XStream
instance with some of the types secured for you. It does so by finding the package name of the @EnableAutoConfiguration
annotated class. Note that @SpringBootApplication
is meta-annotated with @EnableAutoConfiguration
.
Axon's auto-config will allow all types under that package but that's it. The framework also gives you a warning, stating the following on INFO level:
Initializing an XStream instance since none was found.
The auto configuration base packages will be used as wildcards for the XStream security settings.
With all that said, I have two recommendations for you:
- If you want to stick with XStream as the serializer, I recommend configuring an
XStream
instance manually. This gives you complete control over which classes can or cannot be serialized, solving the exception mentioned earlier.
- If you're not religious about the serializer you're using, you can try out the
JacksonSerializer
that Axon Framework provides. This will require you to make all the objects de-/serializable through an ObjectMapper
. Thus introducing additional dependencies and/or annotations.
To read how you can configure a serializer in Axon, I refer to this page of their Reference Guide.