15

I'm using maven_spring 3.1.M2 + hibernate 3.5. Once I put the line <tx:annotation-driven /> in my applicationcontex xml file, the follwoing error will occur:

WARNING: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sat Jul 16 13:00:52 IST 2011]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:350)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1033)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:534)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4721)
    at org.apache.catalina.core.StandardContext$4.call(StandardContext.java:5423)
        at org.apache.catalina.core.StandardContext$4.call(StandardContext.java:5402)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

What should I do to fix this?

2
  • Please: a) what does your context look like? b) how is your context started (programatically, webapp, etc.) ? Commented Jul 16, 2011 at 9:54
  • You might be missing a class, like I was here: stackoverflow.com/q/8330414 . Are there any other exceptions? Commented Dec 5, 2011 at 18:16

4 Answers 4

5

Do you have AspectJ in your pom.xml or in your lib-directory?

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    <version>3.1.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>${aspectj.version}</version>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>${aspectj.version}</version>
</dependency>

I had the same error and this solved my problem.

Sign up to request clarification or add additional context in comments.

3 Comments

Not work, even already have: spring-aspects-3.2.1.RELEASE.jar aspectjrt-1.7.1.RELEASE.jar aspectjweaver-1.7.1.RELEASE.jar
I would like to see your pom.xml (dependencies only), because I believe that there is a failure in the dependency tree (multiple or not a "fitting" AspectJ and Spring combination).
Now I have removed everything and restart doing the pom again, and it's no more that error. I got many projects dependencies that might be the caused but don't know how to specify telling them...
2

I had the same issue, And solution is the Spring jars Now it depends on person to person which spring jar his project is using and actually which one is missing. For me it happened 3-4 times when I created project. Sometime I had all Spring jar but not the Spring.jar Next time Spring Aspect jar was missing. while some other time I had make sure of all but missed security. But I always fixed it by carefully placing the Spring jars. No need to look for any other reason.

Hope that help and focus on only Spring jars and not others. Happy Coding guys!!

Comments

1

I faced this issue when using both jersey-spring3 and spring-core. The jersey-spring3.jar, uses its own version for Spring libraries, so to use the ones you want, you need to exclude these libraries manually.

<dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
        <version>2.22.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>bean-validator</artifactId>
                <groupId>org.glassfish.hk2.external</groupId>
            </exclusion>
        </exclusions>
    </dependency>

Comments

0

resolve conflict version the spring dependencies in pom.xml , may be in various version change class name or add feature that in other dependencies has incompatibility.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.