tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: NPE in afterRender method in Tomcat
Date Mon, 07 Jun 2010 20:58:10 GMT
Caused by: java.lang.NullPointerException
       at
org.apache.catalina.connector.Request.getAttribute(Request.java:877)
       at
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)

That's really showing that it's gone beyond the Tapestry code and back into
the Tomcat (catalina) code. Are you doing something tricky with threads,
like trying to do part of the render is a background thread?

You'll probably need to single-step down ingo the catalina code to see
what's exactly going on.  Not enough information here to diagnose.

On Mon, Jun 7, 2010 at 1:13 PM, Radek Terber <lst.ara@post.cz> wrote:

> Hi
>
> I have such problem: I have quite simple T5 application - (T5 + hibernate),
> currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0),
> it runs fine.
> But when I try it to start under Tomcat, I get NullPointerException that
> (probably) indicates the underline request is null.
> I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was "pure"
> installations - with no aditional libraries.
> It runs under Java 6.18 on Win7, the same problem in on Linux and Java
> 6.16.
> I could post application's war somewhere, but it is quite big (cca 28M
> including libraries), ant it requires our application server running
> anywhere in LAN to run.
>
> Here it the eception:
> -------------------
> [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
> with uncaught exception: Render queue error in AfterRender[Index
> :layout.loginform]:
> org.apache.tapestry5.ioc.internal.util.TapestryException
> org.apache.tapestry5.internal.services.RenderQueueException: Render queue
> error in AfterRender[Index:layout.loginform]: org.apache.tapestry5
> .ioc.internal.util.TapestryException [at
> classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
>        at
> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86)
>        at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
> ... (I deleted it) ...
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at
> classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374)
>        at
> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74)
>        ... 68 more
> Caused by: java.lang.NullPointerException
>        at
> org.apache.catalina.connector.Request.getAttribute(Request.java:877)
>        at
> org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
>        at
> cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127)
>        at
> cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
>        ... 72 more
>
>
> The code fragment cause it:
> -------------------------------------------------------
>    @Inject
>    private RenderSupport rsup;
>
>    @Inject
>    private Request request;
>
>    @AfterRender
>    public void afterRender(MarkupWriter wr) {
>         boolean requireLogin =
> request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;        // here
> the NPE is thrown, but the "request" is not null
>        if (requireLogin) {
>            rsup.addScript("$j(function() {");
>            rsup.addScript("$j(\"#loginFormDialog\").dialog(\"option\",
> \"modal\", false);");
>            rsup.addScript("$j(\"#loginFormDialog\").dialog(\"open\");");
>            rsup.addScript("});");
>        }
>    }
>
> -------------------------------------------------------
>
> Thanks for any ideas.
> Radek
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message