holixon / axon-cdi

CDI Extension to use AxonFramework 3.x in Container Environments
Apache License 2.0
4 stars 1 forks source link

Fix CommandHandler bug in example #6

Closed zambrovski closed 6 years ago

zambrovski commented 6 years ago

Currently example is not working and reports

org.axonframework.commandhandling.NoHandlerForCommandException: No handler was subscribed to command [org.axonframework.extension.example.minimal.core.api.CreateAccountCommand]
    at org.axonframework.commandhandling.SimpleCommandBus.lambda$doDispatch$0(SimpleCommandBus.java:122)
    at java.util.Optional.orElseThrow(Optional.java:290)
    at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:120)
    at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:91)
    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.send(DefaultCommandGateway.java:143)
    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:497)
    at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)
    at org.jboss.weld.proxies.CommandGateway$25304444$Proxy$_$$_WeldClientProxy.send(Unknown Source)
    at org.axonframework.extension.example.minimal.CdiApplication.run(CdiApplication.java:31)
    at org.axonframework.extension.example.minimal.WeldApplicationRunner.main(WeldApplicationRunner.java:17)

I belive this bug is related to #4 and will be fixed as soon as BeanManager can instantiate the Account Aggregate.

alexmacavei commented 6 years ago

Yep, this is the issue I was having myself. It looks like the @Observes methods in the extension class never gets called. I thought it's because CDI doesn't scan the stereotypes by default, just the scope annotations. That's why I asked about using beans.xml with discovery=all.

Pe 7 ian. 2018 16:09, "Simon Zambrovski" notifications@github.com a scris:

Currently example is not working and reports

org.axonframework.commandhandling.NoHandlerForCommandException: No handler was subscribed to command [org.axonframework.extension.example.minimal.core.api.CreateAccountCommand] at org.axonframework.commandhandling.SimpleCommandBus.lambda$doDispatch$0(SimpleCommandBus.java:122) at java.util.Optional.orElseThrow(Optional.java:290) at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:120) at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:91) 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.send(DefaultCommandGateway.java:143) 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:497) at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100) at org.jboss.weld.proxies.CommandGateway$25304444$Proxy$_$$_WeldClientProxy.send(Unknown Source) at org.axonframework.extension.example.minimal.CdiApplication.run(CdiApplication.java:31) at org.axonframework.extension.example.minimal.WeldApplicationRunner.main(WeldApplicationRunner.java:17)

I belive this bug is related to #4 https://github.com/holisticon/axon-cdi/issues/4 and will be fixed as soon as BeanManager can instantiate the Account Aggregate.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/holisticon/axon-cdi/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ_PRX7Gbh0AUBNclK1uY-a9ztWlMVkCks5tINAvgaJpZM4RVqRr .

zambrovski commented 6 years ago

I'm on it...

zambrovski commented 6 years ago

The bug is fixed. It occures if the Configuration is not started.