Axon(4.0.3)can't find commandhandler NoHandlerForCommandException

Hi,
I m trying to send a command from Microservice 1 to Microservice 2 (with Saga) But I m getting this error org.axonframework.commandhandling.NoHandlerForCommandException(No handler was subscribed to command).
I don 't understand why? First, I used Axon simply with commandGateway everything ok Axon registers automatically all commandhandlers, so that I found all commands in axon dashboard But I moved to DefaultCommandGateway because I was obliged to implement CommandInterceptors, axon don’t show commands in axon dashboard and don’t recongnize command hanlder in another microservice. Here is my axon config:

Capture.PNG

Capture2.PNG

Please anyone can help me.

Thank You

Nouha Kacem

Hi Nouha,

I guess you’re using AxonServer to distribute the commands between nodes?
Note that the Spring Boot autoconfiguration will only configure beans that you haven’t defined yourself. I see your configuration defines a CommandBus bean, which basically instructs the autoconfiguration not to configure a CommandBus anymore. This replaces the Distributed CommandBus with a local one.

I see you configure a DispatchInterceptor and a HandlerInterceptor on the CommandBus. Instead of creating a bean with those interceptors, you can define an @Autowired method taking a CommandBus as a parameter. On that autowired commandBus instance, you can register the interceptors. That way, you leave the creation of the CommandBus to the Autoconfiguration module.

Hope this helps.

Capture.PNG

Capture2.PNG