Serializing an AbstractAnnotatedAggregateRoot<Tree> with Jackson goes wrong..

Hello everyone!

I try to serialize a Class (Tree) that extends the AbstractAnnotatedAggregateRoot and has 2 fields: private String treeId and private int rings.
As I run the serialization I get

com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.axonframework.domain.SimpleDomainEventStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: […])

The reason for this error is, I am pretty sure, that Jackson tries to serialize the fields that are extended by the superclass.
I read that it might be a good idea to use the composite pattern instead of inheriting from AbstractAnnotatedAggregateRoot,
and it would be easy (or at least easier) to tell Jackson to ignore that field. What would it look like? Is it an option? If not:
Does anyone have an idea, what a clean and fast fix for this issue could be?

I’d be glad if someone could help me,
Thanks a lot!


This shouldn't be an issue in Axon 3, which no longer requires your aggregate classes to extend an Axon superclass. If the timing of your project allows it, you might look at the 3.0 milestone releases.

What are you using the serialized object for? The use case will influence the best answer to your question absent moving to Axon 3.

One possibility: you could add Jackson annotations to control the serialization behavior.

If you are using event sourcing you will want to be careful about serializing aggregates on your own since the aggregate object is not the source of truth; it is more like a view of the event stream.



sorry for the delay, I have been off a couple days.
To make it short:
1. I committed to use axon 2 for now.
2. I wanted to send a change of my aggregate to another service, that would
be interested in it, be sending the whole thing.
3. Jackson Annotation do not make it easy to ignore all base class fields
(and it is ugly).
4. I fixed it, by attaching the specific fields to the event, and not the
whole aggregate.

Thanks for the help!