Aggregate Identifiers is unknown org.axonframework.domain.AggregateIdentifierNotInitializedException

I am using version 2.4 of the axon framework and I am getting org.axonframework.domain.AggregateIdentifierNotInitializedException. I have added a new command and an event, code below.
Other commands are working fine. Any help will be much appreciated.


@RequestMapping(value = "/{id}/deactivate", method = RequestMethod.GET)
public void deactivate(@PathVariable("id")  String id) {
    DeactivateOrganisationCommand deactivateOrganisationCommand = new DeactivateOrganisationCommand(id);
} (5.66 KB) (378 Bytes) (317 Bytes)

The problem is that the DeactivateOrganisationCommand is handles by a constructor in your aggregate. That means you’re not deactivating an exiting Organization, but are creating a new one. Only the commands that create a new aggregate should be handled in a constructor. The rest of the commands should be placed on regular methods, so that Axon will load an existing aggregate to handle the commands.

This exception is raised when a newly created aggregate has not been given an identifier. This identifier must be assigned, at the latest, when applying the event that was raised when the aggregate was created.



Thanks a lot, that works.