运行系统时出现如下错误,烦请查看,感谢.

严重: Exception sending context destroyed event to listener instance of class com.bstek.dorado.web.servlet.SpringContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
at com.bstek.dorado.web.servlet.SpringContextLoaderListener.contextDestroyed(SpringContextLoaderListener.java:78)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5124)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5786)
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:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
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)
已邀请:

冷水哥 - 全干工程师

赞同来自: 太和生技

请给@Component注解上增加("id")

Jacky - 规则

赞同来自:

请贴出完整异常

太和生技 - 80后IT男

赞同来自:

此原因我找到了,解释如下:
    ①.我在OAS.TLB.DAO,OAS包下建立了类ZxFileDao.java
    ②.我同时在tts.tlb.dao包下建立了类ZxFileDao.java(与OAS.TLB.DAO,OAS下的类名相同)
    ③.我同时把①,②两个包在Spring中注册,代码如下:
	<context:component-scan base-package="OAS.TLB.DAO">
</context:component-scan>
<context:component-scan base-package="tts.tlb.dao">
</context:component-scan>

    ④就会出现如上错误,我不希望修改类名,也希望两个包都在spring中注册,请问此有什么方法可以解决,感谢.

要回复问题请先登录注册