spring报错java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refre

版权声明:本文为博主柒晓白(邹涛)原创文章,未经博主允许不得转载,否则追究法律责任。 https://blog.csdn.net/ITBigGod/article/details/79948756

spring报错IllegalStateException问题

整合ssm时候关于spring.
项目运行报错:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ befo
报错如下:

严重: 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:1028)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1004)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:578)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)
    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4675)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

解决办法:
在项目的web.xml文件中,找到配置spring的位置。
在classpath的前面加上1个*即可。
这里写图片描述

然后就可以正常运行。


tomcat启动BeanFactory not initialized or already closed - call 'refresh' before ac

04-13

tomcat启动后报错rnjava.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContextrn at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)rn at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1006)rn at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:982)rn at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:934)rn at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:581)rn at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)rn at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4858)rn at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5474)rn at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at java.lang.Thread.run(Thread.java:745)rn请问大神这个是怎么回事,我的配置文件是写在web.xml中的 rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭