I've been trying to obtain my ApplicationContext using ActionSupport and am getting a NullPointerException. I'm sure it's something trivial that I'm forgetting, I've just been staring at it too long so was looking for a little help.
Here's my listener in web.xml:
My (now gutted) BaseAction to retrieve the context: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>
Any reference to getWebApplicationContext() in here won't work. I just get a NullPointerException from that line.Code:import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.web.struts.ActionSupport; public class BaseAction extends ActionSupport { protected static Log log = LogFactory.getLog(BaseAction.class); protected String ctxString = getWebApplicationContext().toString(); }
Does anyone have any idea what the problem is? I'm using Tomcat 5.0.
Thanks in advance,
Mike


Reply With Quote