users@grizzly.java.net

Re: FilterConfigImpl context is NULL.. why ?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 09 Feb 2009 10:43:52 -0500

Salut,

thanks for the detailed analysis, Hubert and I fixed the issue and
more...found another one where FilterConfig.getServletContext() was
never initialized.

I was under the impression I've tested with Hudson last Friday but looks
like I screwed up.

A+

-- Jeanfrancois

Survivant 00 wrote:
> I'm stuck with a NullPointerException when I try to start Hudson with
> GrizzlyWebServer. The npe is simple..
>
> HudsonFilter.java
>
> public void init(FilterConfig filterConfig) throws ServletException {
> this.filterConfig = filterConfig;
> // this is how we make us available to the rest of Hudson.
>
> filterConfig.getServletContext().setAttribute(HudsonFilter.class.getName(),this);
> // CRASH HERE..
> }
>
> I trace the code and
> FilterConfigImpl.getServletContext()
>
> return NULL.. why ?
>
> here some screenshot in debug.
>
>
> The FilterConfig method is that
>
> /**
> * Initialize the {_at_link Filter}
> * @throws javax.servlet.ServletException
> */
> protected void init() throws ServletException{
> for (FilterConfigImpl f: filters){
> f.getFilter().init(f); // LAST SCREENSHOT
> }
> }
>
>
> the filter are declared like that
>
> sa.addFilter(filter, filterType.getFilterName().getValue(), initParamsMap);
>
>
> THe ServletAdapter like that
>
> Servlet servlet = (Servlet)
> ClassLoaderUtil.load(servletType.getServletClass().getValue());
> sa.setServletInstance(servlet);
>
> List<ParamValueType> initParams = servletType.getInitParam();
>
> if (initParams != null) {
> for (Object element : initParams) {
> ParamValueType paramValueType = (ParamValueType) element;
>
> sa.addInitParameter(paramValueType.getParamName().getValue(),
> paramValueType.getParamValue().getValue());
> }
> }
>
>
> sa.setContextPath("/");
>
> ws.addGrizzlyAdapter(sa, new String[]{"/"});
>
> need help for this one
>
> thanks
>
>
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net