Axon error upon retrieving and reconstructing an existing aggregate state

Hi there,

I am new to axon and am helping to implement an inventory management system. We have a proof of concept setup with event sourced aggregates. Creating new aggregates with an initial state appears to work. When we try to post a ‘correction’ to an exisiting aggregate then things seems to fall apart. I have posted the error below:

17:55:26,683 WARN [org.axonframework.eventsourcing.eventstore.EmbeddedEventStore] (RMI TCP Connection(24)- Error reading snapshot. Reconstructing aggregate from entire event stream. Caused by: java.lang.NullPointerException null
17:55:26,689 WARN [org.axonframework.commandhandling.callbacks.LoggingCallback] (RMI TCP Connection(24)- Command resulted in exception: com.owfg.sim.pim.axon.prototype2.commandside.inventorydocument.commands.CorrectInventoryDocumentCommand: java.lang.NullPointerException
at org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine.fetchDomainEvents(

The error seems to indicate that it checks if there is a snapshot for this existing aggregate root first and then attempts to reconstruct it using its previously committed events. Since we have no snapshots then it would make sense it would go right to the event stream. The events for this aggregate root do exist and I am certain that I am using the correct UUID to obtain a ‘handle’ to it.

Meta Data associated with single event tied to the aggregate root:



. //business specific state information removed

I have bolded the aggregate identifier in the payload. Has anyone encountered something like this? Additionally, I can provide more information wrt our axon setup, but I am unsure where to start and do not want to bog down this post with unnecessary detail. If, however, something is requested then I would be more than happy to post it.

Thank you in advance,


One other thing: we are using Axon 3.0.4

Upon further investigation, I was able to step through the core axon code and came to the source of the issue:

return **transactionManager**.fetchInTransaction(
        () -> entityManager().createQuery(
                "SELECT new org.axonframework.eventsourcing.eventstore.GenericTrackedDomainEventEntry(" +
                        "e.globalIndex, e.type, e.aggregateIdentifier, e.sequenceNumber, " +
                        "e.eventIdentifier, e.timeStamp, e.payloadType, " +
                        "e.payloadRevision, e.payload, e.metaData) " + "FROM " + domainEventEntryEntityName() + " e " +
                        "WHERE e.aggregateIdentifier = :id " + "AND e.sequenceNumber >= :seq " +
                        "ORDER BY e.sequenceNumber ASC")

It would appear the transactionManager member is not set and a null pointer exception is being thrown.

We have this line of code in our configuration:

.configureEmbeddedEventStore(c -> new JpaEventStorageEngine(pimEntityManagerProvider,null))

That null is where the TransactionManager should go. We should investigate further and include a proper transaction manager first on our end. If there are any further issues Ill reply to this thread.


If you’re using Spring, you can use the SpringTransactionManager instance to wrap Spring’s own PlatformTransactionManager.
Otherwise, you’ll have to create an implementation that creates the transactions in the way your current platform expects you to do so.

Kind regards,


Hi Allard,

We ended up doing just that and it worked. Thanks for that. We are now onto saga persistence and the JpaSagaStore.