Intermittent AxonConfigurationException: Command doesn't have a property matching the routing key

Hi all,

I’ve been running an app on Axon Framework 3.4 for some time, but have started to randomly encounter AxonConfigurationExceptions [1]:

o.a.c.AxonConfigurationException: Command of type [class org.example.UnrelatedCommand] doesn’t have a property matching the routing key [applicationId] necessary to route through field [private final java.util.List<org.example.Application> org.example.Customer.applications]

I’m confident that our code and annotations (CommandHandler, Aggregate, AggregateMember, EntityId) are correct since the app works normally most of the time. But occasionally, when dispatching a command, the framework appears to scan for handler annotations and throws an error.

I wonder if anyone else has seen this? It feels like something that’s concurrency/timing related and has been occurring since we allocated multiple CPUs to our ECS service.

Thanks,
Charlie

[1] Full stack trace:
o.a.c.AxonConfigurationException: Command of type [class org.example.UnrelatedCommand] doesn’t have a property matching the routing key [applicationId] necessary to route through field [private final java.util.List<org.example.Application> org.example.Customer.applications]

at o.a.c.m.i.AbstractChildEntityDefinition.extractCommandHandlerRoutingKey(AbstractChildEntityDefinition.java:164)
at o.a.c.m.i.AbstractChildEntityDefinition.lambda$extractCommandHandlerRoutingKeys$3(AbstractChildEntityDefinition.java:148)
at j.u.s.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178)
at j.u.s.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at j.u.s.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at j.u.s.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at j.u.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1675)
at j.u.s.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at j.u.s.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at j.u.s.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at j.u.s.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at j.u.s.ReferencePipeline.collect(ReferencePipeline.java:578)
at o.a.c.m.i.AbstractChildEntityDefinition.extractCommandHandlerRoutingKeys(AbstractChildEntityDefinition.java:146)
at o.a.c.m.i.AggregateMemberAnnotatedChildEntityCollectionDefinition.resolveCommandTarget(AggregateMemberAnnotatedChildEntityCollectionDefinition.java:70)
at o.a.c.m.i.AbstractChildEntityDefinition.lambda$createChildDefinition$0(AbstractChildEntityDefinition.java:61)
at o.a.c.m.i.ChildForwardingCommandMessageHandlingMember.handle(ChildForwardingCommandMessageHandlingMember.java:103)
at o.a.c.m.i.AnnotatedAggregate.handle(AnnotatedAggregate.java:418)
at o.a.c.m.i.AnnotatedAggregate.lambda$handle$3(AnnotatedAggregate.java:394)
at o.a.messaging.Scope.executeWithResult(Scope.java:99)
at o.a.c.m.i.AnnotatedAggregate.handle(AnnotatedAggregate.java:401)
at o.a.c.m.LockAwareAggregate.handle(LockAwareAggregate.java:82)
at o.a.c.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:219)
at o.a.c.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:213)
at o.a.c.AggregateAnnotationCommandHandler.handle(AggregateAnnotationCommandHandler.java:175)
at o.a.c.AggregateAnnotationCommandHandler.handle(AggregateAnnotationCommandHandler.java:44)
at o.a.m.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:57)
at o.a.m.i.CorrelationDataInterceptor.handle(CorrelationDataInterceptor.java:65)
at o.a.m.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
at o.a.m.u.DefaultUnitOfWork.executeWithResult(DefaultUnitOfWork.java:69)
at o.a.c.SimpleCommandBus.handle(SimpleCommandBus.java:148)
at o.a.c.SimpleCommandBus.doDispatch(SimpleCommandBus.java:121)
at o.a.c.SimpleCommandBus.dispatch(SimpleCommandBus.java:85)
at o.a.c.g.AbstractCommandGateway.send(AbstractCommandGateway.java:79)
at o.a.c.g.DefaultCommandGateway.send(DefaultCommandGateway.java:95)
at o.a.c.g.DefaultCommandGateway.send(DefaultCommandGateway.java:143)
at o.e.ApplicationCommandController.submit(ApplicationCommandController.kt:118)

Hi Charlie,

exactly which version are you using? I do recall some concurrency issue in the inspection of entities, which we have addressed, but I don’t recall exactly which version. It should have left a trace on GitHub…

Cheers,