-
[Spirng] BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext프로그래밍 언어/에러노트 2023. 5. 19. 10:51
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:168) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1106) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1075) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1021) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:517) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4816) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5477) 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:1396) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:772) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
스프링 시큐리티 설정 도중 다음과 같은 에러가 발생했다.
위의 예외는 ContextLoaderListener를 제공하는데서 발생하는 예외이다.
나의 경우 web.xml에 아래와 같이 설정해두었는데, security-context.xml 파일을 다른 경로에 생성해두었다.
따라서 appServlet이 아닌 spring 폴더 하위로 위치시켜야된다.
반응형'프로그래밍 언어 > 에러노트' 카테고리의 다른 글
[Spring Boot] java.lang.Boolean is in module java.base of loader 'bootstrap' 에러 해결 (0) 2023.07.07 [Spring Boot] "Path with "WEB-INF" or "META-INF": [WEB-INF/view/index.jsp]" (0) 2023.05.26 [spring 에러] org.springframework.web.context.ContextLoaderListener (0) 2023.05.10 [Spring 에러] "Path with "WEB-INF" or "META-INF": (0) 2023.03.27 [Node.js] bash: npm: command not found 환경변수 설정 (0) 2023.02.20