Getting exception when doing QueryHandling, org.axonframework.queryhandling.NoHandlerForQueryException: No handler for query

hi axon team,

i am trying to fetch Account details from Service-B where i am handling query by @QueryHandler. The query is fired from Service-A.

  1. it was working fine when i was not using EurekaDiscoveryClient .
  2. when i added eureka discovery client i added springCloudHttpBackupCommandRouter
    and i added few configurations which can be found here , now i can able to handle commands and events between multiple services.
  3. but i cannot handle Query request between multiple service.
  4. im scanning the packages where the QueryHandlers are present as specified by Allard, that didnt resolve the issue

please any one help me out solving this issue. below is my code snippet.

from Service A im firing the Query.
CompletableFuture account = queryGateway.query(
new AccountDetailsQuery(accountId), ResponseTypes.instanceOf( Account .class));

where AccountDetailsQuery will be in core-api and ll be added as jar file in both service-A and in Service B.

im handling that Query in Service-B using @QueryHandler
public Account getAccountDetails(AccountDetailsQuery query) throws Exception {,query.getClass().getSimpleName());
return new Account(query.getAccountId(),“afffef”)

im scaning this package too.

public QueryGateway getQueryGateway(SimpleQueryBus simpleQueryBus){
/Configurer configurer = DefaultConfigurer.defaultConfiguration();
QueryBus queryBus = configurer.buildConfiguration().queryBus();
return DefaultQueryGateway.builder().queryBus(simpleQueryBus).build();

im getting excepton as
2020-08-13 18:45:14 [EventProcessor[AccountManagementSagaProcessor]-0] WARN o.a.c.gateway.DefaultCommandGateway - Command ‘’ resulted in java.util.concurrent.ExecutionException(org.axonframework.queryhandling.NoHandlerForQueryException: No handler for query:

it would be helpful if anyone resolves this issue.



Sorry, i forgot to mention the axon version. I am using Axon 4.3.

Hi Siddu,

AxonFramework doesn’t have a DistributedQueryBus implementation for Spring Cloud Discovery. There is only a SimpleQueryBus and an AxonServerQueryBus implementation available.
That means distributed query messages is currently only supported (out of the box) when using AxonServer.