spring配置初始化出錯


昨天配置maven項目的時候,報了一個錯誤。

警告: 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 [Thu Dec 14 23:56:52 CST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:416) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:997) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:581) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4889) at org.apache.catalina.core.StandardContext.stopInternal(Stan

相關錯誤信息

 

 initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date
先來看一下百度翻譯,spring初始化錯誤

接着去網上找了好久都沒有一個好的答案,各類說法都不統一。

有說缺少jar包,有說jdk版本不對,還有說清理下項目重啟就可以了。

但是試了一晚上后都不能解決問題。
最后終於在這里找到了問題的原因


Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'adminUserRoleService' for bean class [com.rupeng.service.AdminUserRoleService] conflicts with existing, non-compatible bean definition of same name and class [com.rupeng.service.copy.AdminUserRoleServic

提示
 Annotation-specified bean name 'adminUserRoleService' for bean class [com.rupeng.service.AdminUserRoleService] conflicts with existing, non-compatible bean definition of same name and class [com.rupeng.service.copy.AdminUserRoleServic



找到問題存在兩個service包沖突,刪除copy文件后項目啟動成功。

這個錯誤告訴我們,出了問題查看根異常有多么重要。
也就是Caused by這句話。然后去檢查相應的錯誤就可以了






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM