This seems to look like a filter-order issue. My login ends up trying to look up a bean, which calls this static method:
Code:
public static WebApplicationContext getContext() {
try {
return WebApplicationContextUtils.getWebApplicationContext(ServletActionContext.getServletContext());
} catch (Throwable t) {
log.error("Couldn't get a WebApplicationContext", t);
return null;
}
}
Unfortunately, I get an exception:
Code:
java.lang.IllegalArgumentException: ServletContext must not be null
at org.springframework.util.Assert.notNull(Assert.java:113)
at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:54)
at edu.vt.iddl.meval.util.SpringUtils.getContext(SpringUtils.java:31)
at edu.vt.iddl.meval.util.SpringUtils.getBean(SpringUtils.java:44)
at edu.vt.iddl.meval.util.Bean.get(Bean.java:18)
at edu.vt.iddl.meval.auth.EdAuthDelegate.canonicalize(EdAuthDelegate.java:60)
at edu.vt.iddl.meval.auth.EdAuthDelegate.affiliations(EdAuthDelegate.java:89)
at edu.vt.iddl.meval.auth.AuthDelegateProvider.authenticate(AuthDelegateProvider.java:106)
at org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
...
It looks like the ServletActionContext doesn't get initialized until the Struts 2 filter stack is loaded, but that's after the Acegi stuff. Unfortunately, my delegate that looks up the username/password/userdetails is called from Acegi, but doesn't have the ServletActionContext data set up.
Any ideas how else I could get the WebApplicationContext for the current thread? The bean that I'm looking up is a single instance that doesn't change throughout the run of the app.
Thanks in advance,
-Lally