AggregateMember inheritance: No handler was subscribed to command

I have the below aggregate which contains an aggregate member.

public class CpaAggregate {

	private String externalId;

	private Entity entity;

	public CpaAggregate() {

	public CpaAggregate(CreateCpaCommand cmd) {
		AggregateLifecycle.apply(new CpaCreatedEvent(...));

	protected void on(CpaCreatedEvent evt) {


public class Entity {

	private String entityId;
	private Set<Identifier> identifiers = new HashSet<>();

	public Entity() {

	public void on(IdentifiantUpdatedEvent evt) {

public class Laboratory extends Entity {

	private OperatingSystem operatingSystem;

	public Laboratory() {
	public void handle(UpdateIdentifierLABCommand cmd) {
	   AggregateLifecycle.apply(new IdentifiantUpdatedEvent(....));
commandGateway.sendAndWait(new UpdateIdentifierLABCommand(...));

When i send a command to update an identifier of entity of type laboratory, i get this error

org.axonframework.commandhandling.NoHandlerForCommandException: No handler was subscribed to command [UpdateIdentifierLABCommand]

Hmmm l think I have faced this issue before maybe try adding a type parameter on aggregate member annotation like this.

@AggregateMember(type = Laboratory.class)

Hi @Aymen_Kanzari,

I believe it to be a duplicate of a question posted on stackoverflow and already answered by my colleague @Steven_van_Beelen!

Since I left the link here, I will mark it as resolved but feel free to follow up with additional questions or comments.


1 Like