java.lang.IllegalStateException: WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy

Spring JIRA | Yaozong Zhu | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I am trying to integrate my tests into Spring 2.5 availing of TestContext annotations. But I met a support issue. The followings are relevant codes: @RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners(value = { DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class }) @ContextConfiguration(locations = { "classpath:/applicationContext-resources.xml", "classpath*:/applicationContext.xml" }, inheritLocations = true) @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) @Transactional public abstract class BaseTestCase extends AbstractJUnit4SpringContextTests {...} @ContextConfiguration(locations = { "classpath:/applicationContext-jmx.xml", "/WEB-INF/applicationContext*.xml", "/WEB-INF/dispatcher-servlet.xml" }, inheritLocations = true) public abstract class BaseWebControllerTestCase extends BaseTestCase{...} public class UserFormControllerTest extends BaseWebControllerTestCase{ @Autowired private UserFormController c = null; @Test ... } java.lang.IllegalStateException: WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy at org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext(WebApplicationObjectSupport.java:101) at org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext(WebApplicationObjectSupport.java:115) ...

    Spring JIRA | 9 years ago | Yaozong Zhu
    java.lang.IllegalStateException: WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy
  2. 0

    I am trying to integrate my tests into Spring 2.5 availing of TestContext annotations. But I met a support issue. The followings are relevant codes: @RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners(value = { DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class }) @ContextConfiguration(locations = { "classpath:/applicationContext-resources.xml", "classpath*:/applicationContext.xml" }, inheritLocations = true) @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) @Transactional public abstract class BaseTestCase extends AbstractJUnit4SpringContextTests {...} @ContextConfiguration(locations = { "classpath:/applicationContext-jmx.xml", "/WEB-INF/applicationContext*.xml", "/WEB-INF/dispatcher-servlet.xml" }, inheritLocations = true) public abstract class BaseWebControllerTestCase extends BaseTestCase{...} public class UserFormControllerTest extends BaseWebControllerTestCase{ @Autowired private UserFormController c = null; @Test ... } java.lang.IllegalStateException: WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy at org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext(WebApplicationObjectSupport.java:101) at org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext(WebApplicationObjectSupport.java:115) ...

    Spring JIRA | 9 years ago | Yaozong Zhu
    java.lang.IllegalStateException: WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy
  3. 0

    Thymeleaf uses parent application context when using a child application context

    GitHub | 3 years ago | ghillert
    java.lang.IllegalStateException: WebApplicationObjectSupport instance [org.thymeleaf.spring4.view.ThymeleafView@23e655f6] does not run in a WebApplicationContext but in: org.springframework.context.annotation.AnnotationConfigApplicationContext@5ae81e1: startup date [Wed Sep 24 13:52:51 EDT 2014]; root of context hierarchy
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Struts-Menu and Spring

    struts-menu | 1 decade ago | hippie1
    java.lang.IllegalStateException: WebApplicationObjectSupport instance \[net.sf.navigator.menu.MenuLoader@1e04a35\] does not run in a WebApplicationContext but in: org.springframework.context.support.ClassPathXmlApplicationContext: display name \[org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=23167422\]; startup date \[Thu Jun 22 08:51:45 CEST 2006\]; root of context hierarchy

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      WebApplicationObjectSupport instance [xxx.UserFormController@123961b] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@1fc2fb: display name [org.springframework.context.support.GenericApplicationContext@1fc2fb]; startup date [Mon Apr 28 15:35:37 BST 2008]; root of context hierarchy

      at org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext()
    2. Spring
      WebApplicationObjectSupport.getServletContext
      1. org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext(WebApplicationObjectSupport.java:101)
      2. org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext(WebApplicationObjectSupport.java:115)
      2 frames