Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`AnnotationConfigNonEmbeddedWebApplicationContext` has not been refreshed yet

Installing a SpringBoot Legacy (web.xml) WAR application with filters (DelegatingFilterProxy), I was given the following error/stacktrace:

java.lang.IllegalStateException: org.springframework.boot.legacy.context.web.AnnotationConfigNonEmbeddedWebApplicationContext@fff88888 has not been refreshed yet

The supplied logs...

[ERROR] 2016-01-11 11:11:11,265 org.springframework.web.servlet.DispatcherServlet - Context initialization failed
java.lang.IllegalStateException: org.springframework.boot.legacy.context.web.AnnotationConfigNonEmbeddedWebApplicationContext@fff88888 has not been refreshed yet
        at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1041)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1059)
        at org.springframework.web.servlet.DispatcherServlet.initMultipartResolver(DispatcherServlet.java:497)
        at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:479)
        at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:471)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:559)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
        at javax.servlet.GenericServlet.init(GenericServlet.java:161)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1375)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1024)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3815)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:456)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:518)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:309)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:280)
        at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)
        at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643)
        at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1720)
[ERROR] 2016-01-11 11:11:11,266 com.ibm.ws.webcontainer.servlet.ServletWrapper - Uncaught.init.exception.thrown.by.servlet
[ERROR] 2016-01-11 11:11:11,267 com.ibm.ws.webcontainer.webapp - SRVE0293E: [Servlet Error]-[appServlet]: java.lang.IllegalStateException: org.springframework.boot.legacy.context.web.AnnotationConfigNonEmbeddedWebApplicationContext@fff88888 has not been refreshed yet
        at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1041)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1059)
        at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
        at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)
        at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:604)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:511)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:316)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:389)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1104)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3815)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:456)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:518)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:309)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:280)
        at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)
        at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643)
        at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1720)

Applications versions:

  • Websphere Application Server: 8.0.0.10
  • SpringBoot: 1.3.3.RELEASE

Similar issues (their fixes were unrelated):

  • AnnotationConfigApplicationContext has not been refreshed yet - what's wrong?
  • Spring 4 upgrade now junit tests fails on "GenericApplicationContext has not been refreshed yet"?
  • AnnotationConfigApplicationContext has not been refreshed yet
like image 755
Nick Grealy Avatar asked Jun 10 '16 15:06

Nick Grealy


People also ask

How do I refresh application context in spring boot?

You can use: POST to /actuator/env to update the Environment and rebind @ConfigurationProperties and log levels. /actuator/refresh to re-load the boot strap context and refresh the @RefreshScope beans. /actuator/restart to close the ApplicationContext and restart it (disabled by default).

What is AnnotationConfigApplicationContext?

AnnotationConfigApplicationContext is a standalone application context which accepts annotated classes as input. For instance, @Configuration or @Component . Beans can be looked up with scan or registered with register .


1 Answers

Sorry to do the question+answer thing. Hopefully this is helpful to someone else...

Looking at (only) the stacktrace provided, it looks like the issue occurred when the DelegatingFilterProxy asserted if the BeanFactory was active (this is a good start, sounded like the application context had an issue initialising...).

Upon getting access to the FULL logs, I found out the application context had failed much earlier on (issue with creating a bean - a missing file), and that this message was just the "ripples" from that original issue.

Moral of the story (tl;dr):

  • this stacktrace is a symptom, look for the root cause (& check the full logs)
like image 64
Nick Grealy Avatar answered Sep 24 '22 02:09

Nick Grealy