当前位置:网站首页>BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the Applic
BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the Applic
2022-07-28 17:34:00 【Alex_designer】
背景:
启动报错:
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
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:1006)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)
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:4791)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5428)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1439)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1439)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.I
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:655)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
原因
之前我用的是jetty启服务一直是正常的,今天用 tomcat 启服务被暴初始化失败
原因是spring会在默认地址下没有找到applicationContext.xml文件,由于我重新命名,地址也变了,所以需要在web.xml中配置路径
方案
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/applicationContext-api.xml</param-value>
</context-param>加完后成功启动!
边栏推荐
- Rust 入门指南(rustup, cargo)
- Photoshop web design practical tutorial
- SaltStack之salt-ssh
- 这种动态规划你见过吗——状态机动态规划之股票问题(下)
- 在矩池云快速安装torch-sparse、torch-geometric等包
- Pytorch:交叉熵损失(CrossEntropyLoss)以及标签平滑(LabelSmoothing)的实现
- 6-20 vulnerability exploitation proftpd test
- 架构实战营第8模块作业
- SaltStack常用的模块
- Doxygen document generation tool
猜你喜欢

Streamlit machine learning application development tutorial

ACM warm-up exercise 3 in 2022 summer vacation (detailed)

Web 3.0 development learning path

剑指 Offer II 109. 开密码锁

Adobe XD web design tutorial

【已解决】AC86U ML改版固件虚拟内存创建失败,提示USB磁盘读写速度不满足要求
![[radar] radar signal online sorting based on kernel clustering with matlab code](/img/56/1f8e8690b47fc4a1f101d4e530b87f.png)
[radar] radar signal online sorting based on kernel clustering with matlab code

Application of time series database in monitoring operation and maintenance platform

R language text mining and natural language processing tutorial

Powerbi time series analysis, prediction and visualization tutorial
随机推荐
Fundamentals of software testing and development | practical development of several tools in testing and development
Rust 入门指南(crate 管理)
关于白盒测试,这些技巧你得游刃有余~
Method of win7 system anti ARP attack
Application of time series database in monitoring operation and maintenance platform
这种动态规划你见过吗——状态机动态规划之股票问题(下)
初步学习函数(第3篇博客)
Libgdx learning path 01: libgdx introduction and running tutorial
[深入研究4G/5G/6G专题-44]: URLLC-15-《3GPP URLLC相关协议、规范、技术原理深度解读》-9-低延时技术-3-非时隙调度Mini slot
About ASM redundancy
NDK 系列(5):JNI 从入门到实践,爆肝万字详解!
As for the white box test, you have to be skillful in these skills~
Streamlit machine learning application development tutorial
R语言与数据分析实战11-数据的删除
It is the best tool to evaluate six kinds of map visualization software in three categories
Nips18(AD) - 利用几何增广的无监督异常检测《Deep Anomaly Detection Using Geometric Transformations》
VAE: understanding and implementation of variational self encoder
Solve the critical path in FJSP - with Matlab source code
Pytorch:快速求得NxN矩阵的主对角线(diagonal)元素与非对角线元素
ES6 new - arrow function