29

I'm getting the following error when trying to run a project with spring and spring-security (it was running before I added spring security):

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Wed Nov 30 10:49:27 CST 2011]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:337)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1025)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:538)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)
    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4675)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Does anyone know why? I haven't found anything on the interverse.. here's my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.0.xsd">
    <http use-expressions="true">
        <intercept-url pattern="/login" access="permitAll" />
        <intercept-url pattern="/**" access="isAuthenticated()" />
        <form-login login-page="/login" />
    </http>
    <authentication-manager>
        <authentication-provider>
            <password-encoder hash="md5"/>
            <user-service>
                <user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" />
                <user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER,ROLE_TELLER" />
                <user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" />
                <user name="peter" password="22b5c9accc6e1ba628cedc63a72d57f8" authorities="ROLE_USER" />
            </user-service>
        </authentication-provider>
    </authentication-manager>
</beans:beans>

You'll notice it's similar to the tutorial. I've heard this issue might be a bug? Also as far as I know I've added the necessary jars and configuration.. but that might be an issue too. Finally I'm using spring-beans-3.1.xsd and spring-security-3.0.xsd because those match the major/minor version of the jars I have.

6
  • Have you enabled full DEBUG logging on org.springframework? That should tell you exactly who is trying to broadcast what event. What other spring configuration files are you pulling in? What versions of Spring Framework and Security are you using? Commented Nov 30, 2011 at 20:39
  • I'm not sure how to enable that logging on spring. I'm using spring 3.1.0RC1 and spring-security 3.0.7 Commented Dec 2, 2011 at 15:58
  • It turned out to be a jar issue, added the relevant jars and things work now :) Commented Dec 2, 2011 at 16:25
  • 6
    FWIW, I don't think this is too localized. Commented Jun 14, 2013 at 21:49
  • 7
    @AndrewBarber could you justify your reasons for closing this question or open it again please. It has 9 upvotes, 0 downvotes, 3 favorites and an intense irritation on an bad answer. It's also the top Google result for this error message: bit.ly/1ik4wzU Commented May 26, 2014 at 13:20

2 Answers 2

10

add to your pom.xml. This will solve the problem

<dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>2.2.2</version>
</dependency>
Sign up to request clarification or add additional context in comments.

3 Comments

Can you explain why this will solve the problem ?
In my case, that doesn't work.
This does not solve the problem
-42

I was missing some spring security jars. Just didn't think of that when I saw IllegalStateException

15 Comments

What are the missing jar? Can you share all of them? I got the same error but can't figure it out what are the missing...
Any answers on what those JARs are?
what were missing jars ?
Would be great if you could post the missing jars.
The purpose of posting a question is to get help from others and also to help others, not for us to know that you have fixed your problem!!!
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.