java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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) ...
    via by Yaozong Zhu,
  • 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) ...
    via by Yaozong Zhu,
  • 1.4-RELEASE doesnt work
    via GitHub by VyaraGGeorgieva
    ,
  • Struts-Menu and Spring
    via struts-menu by hippie1
    ,
  • I tried to use Struts-Menu with Spring and defined the following bean in my application context: <bean id="menu" class="net.sf.navigator.menu.MenuLoader"> <property name="menuConfig"> <value>/WEB-INF/menu-config.xml</value> </property> </bean> Then the following exception occurs: 2006-06-22 08:52:14,517 ERROR Servlet.service() for servlet default threw exception in (StandardWrapperValve.java:260) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'menu' defined in class path resource [applicationContext-coreResources.xml]: Initialization of bean failed; nested exception is org.springframework.context.ApplicationContextException: Failed to initialize Struts Menu repository; nested exception is 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 Caused by: org.springframework.context.ApplicationContextException: Failed to initialize Struts Menu repository; nested exception is 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 Caused by: 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 at org.springframework.web.context.support.WebApplicationObjectSupport.getWebApplicationContext(WebApplicationObjectSupport.java:71) at org.springframework.web.context.support.WebApplicationObjectSupport.getServletContext(WebApplicationObjectSupport.java:86) at net.sf.navigator.menu.MenuLoader.initApplicationContext(MenuLoader.java:53)
    via by Angela Stempfel,
  • JUnit test, what&#39;s wrong?
    via Stack Overflow by naut92
    ,
    • 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)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,