[英]Error while integrating mongo db with spring
I am trying to integrate mongo db with spring and getting this error,我正在尝试将 mongo db 与 spring 集成并收到此错误,
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 [Wed Jul 29 15:07:09 IST 2015]; 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:578)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4831)
at
org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It is probably because of a bug in the DI algorithm as outlined in this ticket on Spring.io .这可能是因为Spring.io 上的这张票中概述的 DI 算法中的一个错误。 Also refer to this ticket .
另请参阅此票证。 I also hit the same exception using Spring 4.1.7.RELEASE with spring-data-mongodb-1.7.1.RELEASE.
我也使用 Spring 4.1.7.RELEASE 和 spring-data-mongodb-1.7.1.RELEASE 遇到了同样的异常。 This issue seems to occur whenever spring tries to create a bean that depends on spring-data-mongodb.
每当 spring 尝试创建依赖于 spring-data-mongodb 的 bean 时,似乎都会发生此问题。 Your best bet is to wait for Spring 4.2 release tomorrow (July, 30, 2015), as the issue is supposedly fixed in Spring 4.2...we'll just have to see.
最好的办法是等待明天(2015 年 7 月 30 日)Spring 4.2 发布,因为该问题应该在 Spring 4.2 中得到解决……我们只需要看看。
I've googled and looked for workarounds to no avail.我用谷歌搜索并寻找解决方法无济于事。 If someone knows a fix, please let us know!
如果有人知道修复,请告诉我们!
Update * just tried again with Spring 4.2.0.RELEASE and Spring-data-mongodb:1.7.2.RELEASE.更新 * 刚刚用 Spring 4.2.0.RELEASE 和 Spring-data-mongodb:1.7.2.RELEASE 再次尝试。 This issue is fixed!
此问题已修复! :)
:)
Try to use spring version 4.0 as below shown and for more details i have used [ http://www.datastapler.com/mongodb-with-spring-data-rest-webservice.php][1]尝试使用 spring 4.0 版,如下所示,有关更多详细信息,我使用了 [ http://www.datastapler.com/mongodb-with-spring-data-rest-webservice.php][1]
<properties>
<java-version>1.6</java-version>
<org.springframework-version>4.0.0.RELEASE</org.springframework-version>
<org.aspectj-version>1.7.4</org.aspectj-version>
<org.slf4j-version>1.7.5</org.slf4j-version>
<jackson.databind-version>2.2.3</jackson.databind-version>
</properties>
<!-- mongodb java driver -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.0</version>
</dependency>
<!-- Spring data mongodb -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.