I've been using Hazelcast 1.9.2.3 for a while, using Hazelcast.getMap() and Hazelcast.getIdGenerator() and so on, but now trying to update to 2.4 all that is deprecated.At first I tried using Hazelcast.newHazelcastInstance(null) instead, but then I got lots of instances instead of just one per Tomcat like I want. Now I'm trying to use spring-hazelcast instead to get a HazelcastInstance with @Autowire. In my context.xml-file I have:--<bean id="hzInstance" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance"><constructor-arg><bean class="com.hazelcast.config.Config"/> <!-- Default config... --></constructor-arg></bean>And trying to use it like any other bean:public class ExceptionLoggerImpl implements ExceptionLogger {@Autowired private NodeInfoService nodeInfoService;@Autowired private HazelcastInstance hzInstance;private final IMap<ExceptionDataKey, ExceptionDataInfo> exceptionMap = hzInstance.getMap("exceptionLogger-exceptionMap");But it always fails in the following way:Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.unikum.service.impl.ExceptionLoggerImpl]: Constructor threw exception; nested exception is java.lang.NullPointerExceptionat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)... 110 moreCaused by: java.lang.NullPointerExceptionat net.unikum.service.impl.ExceptionLoggerImpl.<init>(ExceptionLoggerImpl.java:26)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)at java.lang.reflect.Constructor.newInstance(Constructor.java:513)at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)... 112 moreRow 26 is where I do hzInstance.getMap(). I'm basically using the default hazelcast.xml config. I've tried converting it to a spring-config<hz:hazelcast id="instance"><hz:config><hz:group name="dev" password="dev-pass"/><hz:network port="5701" port-auto-increment="false"><hz:join>... and so onbut the result was always the same. If I remove the @Autowired private HazelcastInstance hzInstance; and the map everything starts up as normal. What do I have to do to get the hzInstance?
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/JvH4EE_ICVMJ.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.