开发者

java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context

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)

Wh开发者_如何学运维at should I do to fix this?


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.


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!!


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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜