Using JPA with AxonServerQueryBus

Hi,

I am trying to use Axon Server for a QueryBus only. At the moment JPA event and token stores are autoconfigured (Axon 4.0 with exclusion for axon-server-connector) and are connected to a h2 in memory database.

However, when I am removing the exclusion and explicitly providing beans for JpaTokenStore, JpaEventStorageEngine and EmbeddedEventStore I get the following exception from my TrackingEventProcessor:

o.a.e.TrackingEventProcessor : Fetch Segments for Processor ‘productsearch’ failed: org.hibernate.hql.internal.ast.QuerySyntaxException: DomainEventEntry is not mapped [SELECT MIN(e.globalIndex) - 1 FROM DomainEventEntry e]. Preparing for retry in 60s

Am I missing something or need I to provide more beans myself to override what AxonServerAutoConfiguration has configured? Or should I exlcude AxonServerAutoConfiguration and configure only the AxonServerQueryBus by myself?

Thanks in advance!

Hi Thomas,

this error is caused by the fact that JpaAutoConfiguration for the JpaEventStore isn’t triggered, as there already is an Event Store.
If you have provided your an @EntityScan annotation, you should add “org.axonframework.eventsourcing.eventstore.jpa” as one of the scanned packages. If you don’t have it, you can use Axon’s
@RegisterDefaultEntities(packages = {
“org.axonframework.eventsourcing.eventstore.jpa”
})
to add the correct packages to the ones scanned by default.

Obvisouly, we heavily recommend to keep using AxonServer… :slight_smile:

Cheers,

Allard