users@grizzly.java.net

Re: FilterConfigImpl context is NULL.. why ?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 10 Feb 2009 10:12:31 -0500

Hum...how do you reproduce this issue?

A+

-- Jeanfrancois

Survivant 00 wrote:
> another exception
>
>
>
>
> 2009-02-09 19:01:12 com.sun.grizzly.http.servlet.ServletAdapter service
> GRAVE: service exception:
> java.net.MalformedURLException: favicon.ico
> at
> com.sun.grizzly.http.servlet.ServletContextImpl.getResource(ServletContextImpl.java:301)
> at
> org.kohsuke.stapler.Stapler.openResourcePathByLocale(Stapler.java:150)
> at org.kohsuke.stapler.Stapler.service(Stapler.java:97)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:188)
> at
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:61)
> at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:53)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:172)
> at
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:61)
> at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:53)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:172)
> at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:88)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:172)
> at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:88)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:172)
> at
> com.sun.grizzly.http.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:137)
> at
> com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:279)
> at
> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:165)
> at
> com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:649)
> at
> com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:567)
> at
> com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:824)
> at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:153)
> at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
> at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
>
> 2009/2/9 Survivant 00 <survivant00_at_gmail.com <mailto:survivant00_at_gmail.com>>
>
> thanks
>
> it works now.
>
>
>
>
> 2009/2/9 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com
> <mailto:Jeanfrancois.Arcand_at_sun.com>>
>
> 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
> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
> For additional commands, e-mail:
> users-help_at_grizzly.dev.java.net
> <mailto:users-help_at_grizzly.dev.java.net>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
> <mailto:users-help_at_grizzly.dev.java.net>
>
>
>