SSH : java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh

今天在整合spring和struts2时,出现了这个错误

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:997)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:973)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:925)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5165)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5829)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

之所以会包这个错误是因为我没有在web.xml中配置spring的监听器,并且没有配置applicationContext.xml的配置文件,导致无法启动Tomcat.
如果遇到这种错误,特别是整合spring和struts2时,一定要注意是否配置了spring的监听器以及对应的applicationContext.xml.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值