I am trying to load a an AggregateRoot using the respository (I am using a MongoEventStore) but I get AggregateIdentifierNotInitializedException thrown: the problem occurs when the AbstractMessageHandler#matches(Message) is called more exactly in line 2 :
1.Assert.notNull(message, "Event may not be null");
2.if (payloadType != null && !payloadType.isAssignableFrom(message.getPayloadType())) {
3. return false;
4.}
5. for (ParameterResolver parameterResolver : parameterValueResolvers) {
6. if (!parameterResolver.matches(message)) {
7. return false;
8. }
9.}
10.return true;
message.getPayloadType() returns: class com.acme.cqrs.common.PostCreatedEvent
but with a different classLoader than the one returned payloadType which returns also a :class com.acme.cqrs.common.PostDownvotedEvent
So the aggregate is not intialized because no eventHandler methods is found in the Aggregate class and so the AggregateIdentifierNotInitializedException
is thrown in a later stage.
Any help will be appreciated.