While creating aggregate and if a runtime exception was thrown, instead of propagating that exception, a NullPointerException is being thrown.
This is the line that causing the issue - at org.axonframework.modelling.command.LockingRepository.prepareForCommit(LockingRepository.java:130)
I think, the LockingRepository trying to assert aggregator’s state but aggregate itself not present because the exception was thrown while creating it.
How to get access to the actual exception?
Please help.
Example:
@CommandHandler
public User(CreateUserCommand command) {
// Some RuntimeException
}
CreateUserCommand command = new CreateUserCommand(username, firstName, lastName);
// Here instead of receiving that runtime exception we get NullPointerException
commandGateway.sendAndWait(command);