当前位置:网站首页>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>加完后成功启动!
边栏推荐
- BLDC 6步换相 simulink
- As for the white box test, you have to be skillful in these skills~
- Application of time series database in cigarette factory
- Random finite set RFs self-study notes (6): an example of calculation with the formula of prediction step and update step
- TSDB and blockchain
- 顺序线性表——课上练
- Cvpr21 unsupervised anomaly detection cutpaste:self supervised learning for anomaly detection and localization
- Pyg builds heterogeneous graph attention network han to realize DBLP node prediction
- CVPR19 - 调参干货《Bag of Tricks for Image Classification with Convolutional Neural Network》
- Application of time series database in monitoring operation and maintenance platform
猜你喜欢

Libgdx learning path 01: libgdx introduction and running tutorial

Kotlin Android development novice tutorial

VAE: understanding and implementation of variational self encoder

Accumulation and development -- the way of commercialization of open source companies

From Bayesian filter to Kalman filter (2)
![[solved] ac86u ml revision firmware virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements](/img/1c/6dbfcb5e6ade52d8cbfabcb34616a5.png)
[solved] ac86u ml revision firmware virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements

Get to know nodejs for the first time (with cases)

How many of the top ten test tools in 2022 do you master

Adobe Flash player 34.0.0.92 and available version modification methods (2021-01-23

架构实战营第8模块作业
随机推荐
用LEX(FLEX)生成PL语言的词法分析器
[data analysis] realize SVDD decision boundary visualization based on MATLAB
Pytorch:交叉熵损失(CrossEntropyLoss)以及标签平滑(LabelSmoothing)的实现
搜索问题与技术
Avoidance Adjusted Climbrate
About ASM redundancy
[image hiding] digital image information hiding system based on DCT, DWT, LHA, LSB, including various attacks and performance parameters, with matlab code
Parity rearrangement of Bm14 linked list
VIM learning manual
Application of time series database in intelligent power consumption field
When CNN meets transformer cmt:revolutionary neural networks meet vision transformers
Update of objects in ES6
Mid 2022 summary
英语文章翻译-英语文章翻译软件-免费批量翻译
Rust 入门指南(modules 和工程结构)
Server body 21: pre compilation processing by different compilers (a brief introduction to MSVC and GCC)
Solve the critical path in FJSP - with Matlab source code
剑指 Offer II 109. 开密码锁
Accumulation and development -- the way of commercialization of open source companies
From Bayesian filter to Kalman filter (I)