"No node known to accept" since Axon 3.0.3 using JGroups

Hi,

Since the upgrade to Axon 3.0.3, I got “No node known to accept … Command” exceptions.
I’m using JGroups but only have 1 node in the cluster at the moment.

Any idea?

2017-04-13 11:35:05,347 ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]] [http-nio-8080-exec-1] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.axonframework.commandhandling.distributed.CommandDispatchException: No node known to accept com.brutex.warehouse.receiving.commands.AnnounceShipmentCommand] with root cause
org.axonframework.commandhandling.distributed.CommandDispatchException: No node known to accept com.brutex.warehouse.receiving.commands.AnnounceShipmentCommand
at org.axonframework.commandhandling.distributed.DistributedCommandBus.lambda$dispatch$4(DistributedCommandBus.java:125)
at org.axonframework.commandhandling.distributed.DistributedCommandBus$$Lambda$241/689296204.get(Unknown Source)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.axonframework.commandhandling.distributed.DistributedCommandBus.dispatch(DistributedCommandBus.java:125)
at org.axonframework.commandhandling.gateway.AbstractCommandGateway.send(AbstractCommandGateway.java:79)
at org.axonframework.commandhandling.gateway.DefaultCommandGateway.send(DefaultCommandGateway.java:95)
at org.axonframework.commandhandling.gateway.DefaultCommandGateway.sendAndWait(DefaultCommandGateway.java:113)
at com.brutex.warehouse.receiving.controllers.CommandRestController$$Lambda$234/1601322554.accept(Unknown Source)
at java.util.Optional.ifPresent(Optional.java:159)
at com.brutex.utils.lang.optional.OptionalConsumer.ifPresent(OptionalConsumer.java:22)
at com.brutex.warehouse.receiving.controllers.CommandRestController.processCommand(CommandRestController.java:46)
at com.brutex.warehouse.receiving.controllers.CommandRestController.lambda$publishCommand$48(CommandRestController.java:36)
at com.brutex.warehouse.receiving.controllers.CommandRestController$$Lambda$231/7983385.accept(Unknown Source)
at java.util.Optional.ifPresent(Optional.java:159)
at com.brutex.utils.lang.optional.OptionalConsumer.ifPresent(OptionalConsumer.java:22)
at com.brutex.warehouse.receiving.controllers.CommandRestController.publishCommand(CommandRestController.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Only the external defined handlers are registred, but not the commandhandlers that are defined in the aggregate.

Hi Koen,

Does this exception occur when you’re starting up your application, or when you’re trying to publish the ‘AnnounceShipmentCommand’ from the exception?

You point out that only the external defined handlers are registered.
Where is the @CommandHandler for ‘AnnounceShipmentCommand’ situated?

Hoping to figure out how to help :slight_smile:

Cheers,

Steven

Hi Steven,

It’s annotated in an aggregate like this.

@CommandHandler
public ShipmentReceivingAggregate(AnnounceShipmentCommand incomingShipment)
{

I’ve just noticed that the command handlers that are annotated on methods in the aggregates, are registered on a “SimpleCommandBus” via AggregateConfigurer.
AggregateConfigurer uses the “parent” member to get the CommandBus, this is the DefaultConfigurer and has the ‘SimpleCommandBus’ as CommandBus.

Any idea how to have these registered on the DistrubutedCommandBus?

Kind regards,
Koen

Hi,

I got the same issue. Tried both JGroup & SpringCloud, neither works.
V3.0.2 is fine with JGroup.

在 2017年4月13日星期四 UTC+8下午6:41:44,Koen Verwimp写道:

Hi Koen, Edison,

The DistributedCommandBus will always have a localSegment qualified command bus, which in general is a SimpleCommandBus.
The DistributedCommandBus then checks whether to publish the command through the localSegment or send it over the wire.

To dig even deeper to understanding the issue:
How is your app configured?
Are you using the spring auto configuration?
Are there any Axon beans you define yourself?

Cheers,

Steven

This seems to be an issue with the Autoconfiguration. There is a timing issue that causes some handlers (those defined on the Aggregate) to be registered with the command bus, before the distributed command bus is being autoconfigured.

We’re working on a solution.
To work around this issue, simply define the DistributedCommandBus bean explicitly in your context:

@Bean
@Primary
public DistributedCommandBus distributedCommandBus(CommandRouter router,
                                                   CommandBusConnector connector) {
    return new DistributedCommandBus(router, connector);
}

An bug issue has been created and is worked on.
It’s scheduled for version 3.0.4., which should be released somewhere today.

So, stay tuned for the next version to solve this.

Cheers,
Steven

Hi Steven,

Sorry for the late reply, but THANKs for solving the issue!

Kind regards,
Koen