Announcement Announcement Module
Collapse
No announcement yet.
Newbie Tapestry/Spring Problem: appContext Null Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie Tapestry/Spring Problem: appContext Null

    I have a virtually empty applicationContext.xml and web.xml as per the betterpetshop example. In my Home page, I (try to) instantiate the appContext in a finishLoad method via
    Code:
    WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(cycle.getRequestContext().getServlet().getServletContext());
    if (ac == null)
    {
         throw new ApplicationRuntimeException("once again ac is null.");
    }
    I've tried doing the instantiation in a custom MyEngine as per the spring documentation. The appContext winds up null every time.

    Thanks for any help!

  • #2
    Solved my own problem.

    I needed to have the following in my web.xml (apparently) to load the application context correctly:

    Code:
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    
    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    I also needed to have spring-web.jar in my /WEB-INF/lib. Beans now loading nicely.

    Comment

    Working...
    X