Axon 2.4.5 AbstractMessageHandler#matches(Message) causing AggregateIdentifierNotInitializedException

38 views
Skip to first unread message

Master Mind

unread,
Sep 27, 2016, 3:33:49 PM9/27/16
to Axon Framework Users
Hi All,

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.

Allard Buijze

unread,
Sep 28, 2016, 3:09:15 PM9/28/16
to Axon Framework Users
What kind of environment do you run in? If the same class is loaded by two different classloaders, they are different form the jvm. So one instance from the classloader A is not assignable to the type loaded by classloader B.

Cheers,

Allard
Op di 27 sep. 2016 om 21:33 schreef Master Mind <devca...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Höffling

unread,
Nov 16, 2016, 4:05:47 AM11/16/16
to Axon Framework Users
Hi,

had the same situation.
In my cas it was the Rleoad classloader from spring-boot devtools.
Reply all
Reply to author
Forward
0 new messages