Announcement Announcement Module
Collapse
No announcement yet.
ApplicationEventMulticaster not initialized - with spring-data for mongo Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ApplicationEventMulticaster not initialized - with spring-data for mongo

    I'm currently experiencing the following exception when my spring application starts:

    Code:
    2012-04-27 17:42:51,021 ERROR [main] com.hazelcast.impl.FactoryImpl - /10.188.31.125:54327 [dev] ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.context.support.ClassPathXmlApplicationContext@1fd0fafc: startup date [Fri Apr 27 17:42:46 CEST 2012]; root of context hierarchy
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.context.support.ClassPathXmlApplicationContext@1fd0fafc: startup date [Fri Apr 27 17:42:46 CEST 2012]; root of context hierarchy
           at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:337) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:263) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:364) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:570) ~[spring-core-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:247) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:364) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:570) ~[spring-core-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:247) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:165) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:140) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:65) ~[spring-data-commons-core-1.2.1.RELEASE.jar:na]
           at org.springframework.data.mongodb.core.MongoTemplate.determineCollectionName(MongoTemplate.java:1494) ~[spring-data-mongodb-1.0.1.RELEASE.jar:na]
           at org.springframework.data.mongodb.core.MongoTemplate.findAll(MongoTemplate.java:959) ~[spring-data-mongodb-1.0.1.RELEASE.jar:na]
           at net.bigpoint.globalchat.hazelcast.MongoMapStore.loadAllKeys(MongoMapStore.java:59) ~[classes/:na]
           at com.hazelcast.impl.concurrentmap.MapStoreWrapper.loadAllKeys(MapStoreWrapper.java:131) ~[hazelcast-2.0.2.jar:2.0.2]
           at com.hazelcast.impl.FactoryImpl.checkInitialization(FactoryImpl.java:588) [hazelcast-2.0.2.jar:2.0.2]
           at com.hazelcast.impl.FactoryImpl.getOrCreateProxyByName(FactoryImpl.java:546) [hazelcast-2.0.2.jar:2.0.2]
           at com.hazelcast.impl.FactoryImpl.getMap(FactoryImpl.java:514) [hazelcast-2.0.2.jar:2.0.2]
           at com.hazelcast.impl.FactoryImpl$HazelcastInstanceProxy.getMap(FactoryImpl.java:240) [hazelcast-2.0.2.jar:2.0.2]
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_27]
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_27]
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_27]
           at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_27]
           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactory
    Background:
    • my authenticationProvider for spring-security requires a hazelcast map
    • hazelcast loads data at startup from a mapstore that is based on spring-data for mongo
    • spring data wants to use the ApplicationEventMulticaster
    • it's not there yet.


    as far as i can tell the Multicaster is created when init() on the configurableApplicationContext is called, which seem to happen after the spring security stuff. (imediately after...)

    can i force the the application context to set up the multicaster earlier or to set up hazelcast later?

  • #2
    not sure if its a spring security of general spring issue but spring security classes are initialized before init() on the configurableApplicationContext is called (so before the ApplicationEventMulticaster is created).

    I consider this an important issue because the only way to work around this is to remove dependency injection from my security implementations and get everything by hand from the application context when its used the first time (which i have done for now).

    Can somebody tell me for which project i should create a ticket?

    Comment


    • #3
      Hi,
      You can open it in Spring-Security forum.

      Comment

      Working...
      X