Announcement Announcement Module
Collapse
No announcement yet.
Error: Cannot resolve ServletContextResource without ServletContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error: Cannot resolve ServletContextResource without ServletContext

    hi
    i am getting the folowing error:
    Cannot resolve ServletContextResource without ServletContext
    where trying to get a bean:

    ------------------code-----------------
    XmlWebApplicationContext webContext = new XmlWebApplicationContext();
    webContext.setConfigLocations(new String[] {"WEB-INF/spring-config.xml"});
    ApplicationContext context = webContext;
    webContext.refresh();
    TestUtil testUtil = (TestUtil)context.getBean("testUtil");
    ----------------------------------------
    nay suggestions would be appreciated
    thanks
    darryl

  • #2
    You need to inject ServletContext into your XmlWebApplicationContext. Where is the code you showed located? (listener, servlet etc)

    Comment

    Working...
    X