upgrading from 2.3.2 to 2.4 NPE

44 views
Skip to first unread message

Roland Kofler

unread,
Apr 24, 2015, 5:15:05 AM4/24/15
to axonfr...@googlegroups.com
Same code does not run when changing axon dependency version to 2.4
It results into:

java.lang.NullPointerException
at org.axonframework.unitofwork.DefaultUnitOfWork.publishEvents(DefaultUnitOfWork.java:270)

Is this known?

Allard Buijze

unread,
Apr 24, 2015, 9:36:14 AM4/24/15
to Axon Framework Users
The UnitOfWork hasn't changed in between these versions. A NPE is possible on that line when the event is published to a "null" EventBus. Are you sure the EventBus is properly configured in your repository?

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roland Kofler

unread,
Apr 24, 2015, 10:32:23 AM4/24/15
to axonfr...@googlegroups.com
Confirm the EventBus is 'null' if i use 2.4, but works with 2.3.2
On startup it says that eventBus bean gets instantiated:
16:13:00.121 [localhost-startStop-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'eventBus' to allow for resolving potential circular references
16:13:00.124 [localhost-startStop-1] INFO  org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'eventBus' of type [class org.axonframework.eventhandling.ClusteringEventBus] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
16:13:00.124 [localhost-startStop-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'eventBus'

Config is very simple:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans 
<axon:annotation-config />
...
<bean class="org.axonframework.eventhandling.annotation.AnnotationEventListenerBeanPostProcessor"> 
<property name="eventBus" ref="eventBus"/> 
</bean> 
<axon:event-bus id="eventBus" />
...
</beans>

Allard Buijze

unread,
Apr 24, 2015, 3:16:33 PM4/24/15
to Axon Framework Users
There was a change with an @Resource annotation on the repository, because it caused problems in some situations. It has been removed in 2.4.
To fix your issue, make sure you configure an Event Bus in your Repository configuration. Or use the axon namespace support in your Spring context.

Note that you don't need to configure AnnotationEventListenerBeanProcessor if you also specify "annotation-config".

Roland Kofler

unread,
Apr 25, 2015, 2:30:37 AM4/25/15
to Axon Framework Users
Confirm, this was the problem. Thanks.

You received this message because you are subscribed to a topic in the Google Groups "Axon Framework Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/axonframework/59TpVvl3pdI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to axonframewor...@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages