You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by splounx <na...@haghani.net> on 2006/10/27 19:34:52 UTC

webRequest of RequestGlobals is null Errors

I'm encountering a rather frustrating series of errors caused by the
webRequest property of the RequestGlobals object being null.  In particular,
the error messages look like this:

java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for
tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)>
is null

I understand that the webRequest is not populated into the RequestGlobals
until the InvokeEngineTerminator has done it's thing (as described at
http://issues.apache.org/jira/browse/TAPESTRY-695), however in the
particular cases I'm encountering, the InvokeEngineTerminator has long since
run and the exception seems to be thrown late in the request processing
lifecycle (e.g., when releasing a page, when reporting an exception) and I
don't understand why or how the webRequest is becoming null.

I was hoping I could tap the collective wisdom of this mailing list to try
and shed some light on this.  Some examples:

CASE 1: In this instance, the RequestExceptionReporterImpl is trying to get
at the session by way of the webRequest it is given by HiveMind, and it is
null:

java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for
tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)>
is null.
 at
$WebRequest_10dc961dbc4._targetServiceProperty($WebRequest_10dc961dbc4.java)
 at $WebRequest_10dc961dbc4.getSession($WebRequest_10dc961dbc4.java)
 at $WebRequest_10dc961db76.getSession($WebRequest_10dc961db76.java)
 at
org.apache.tapestry.error.RequestExceptionReporterImpl.reportRequestException(RequestExceptionReporterImpl.java:52)
 at
$RequestExceptionReporter_10dc961db6f.reportRequestException($RequestExceptionReporter_10dc961db6f.java)
 at
$RequestExceptionReporter_10dc961db6e.reportRequestException($RequestExceptionReporter_10dc961db6e.java)
 at
org.apache.tapestry.engine.AbstractEngine.reportException(AbstractEngine.java:132)
 at com.myco.site.view.Engine.reportException(Engine.java:134)
 at
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:294)
 at
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
 at
$WebRequestServicer_10dc961dbb5.service($WebRequestServicer_10dc961dbb5.java)
 at
$WebRequestServicer_10dc961dbb1.service($WebRequestServicer_10dc961dbb1.java)

CASE 2: In this case, I have a custom IPageSource implementation which
modifies the page pooling/caching mechanism in order to introduce some new
parameters to the pool/cache's composite key.  One of the parameters comes
from my visit object, so I try to access it in in the
IPageSource.releasePage() method by doing the following:
page.getRequestCycle.getInfrastructure().getApplicationStateManager().get("visit").

And boom, I get the same NPE (an seen in this debugger exception breakpoint
strack trace):

Thread [http-80-Processor23] (Suspended (exception NullPointerException))
 $WebRequest_10e867167a1._targetServiceProperty() line: not available [local
variables unavailable]
 $WebRequest_10e867167a1.getSession(boolean) line: not available
 $WebRequest_10e86716753.getSession(boolean) line: not available
 SessionScopeManager.getSession() line: 48
 SessionScopeManager.get(String, StateObjectFactory) line: 64
 $StateObjectPersistenceManager_10e867167d0.get(String, StateObjectFactory)
line: not available
 StateObjectManagerImpl.get() line: 50
 ApplicationStateManagerImpl.get(String) line: 60
 $ApplicationStateManager_10e8671672b.get(String) line: not available
 $ApplicationStateManager_10e8671672c.get(String) line: not available
 RequestUtils.getSite(IRequestCycle) line: 92
 SitePageSource.releasePage(IPage) line: 206
 $IPageSource_10e86716727.releasePage(IPage) line: not available
 RequestCycle.cleanup() line: 192
 Engine(AbstractEngine).service(WebRequest, WebResponse) line: 289
 InvokeEngineTerminator.service(WebRequest, WebResponse) line: 60
 $WebRequestServicer_10e86716792.service(WebRequest, WebResponse) line: not
available
 $WebRequestServicer_10e8671678e.service(WebRequest, WebResponse) line: not
available

I've also tried injecting the webRequest directly into my IPageSource
implementation via HiveMind and get the same issue.

As you can see in both stack traces above, the InvokeEngineTerminator has
run and should have initialized the RequestGlobals.webRequest property and I
can't find any code which would clear this out, so not certain how this is
happening.

Any suggestions, comments or insights into what might be happening would be
greatly appreciated!  Turned quite a few hairs white with this one.

Thanks.


-- 
View this message in context: http://www.nabble.com/webRequest-of-RequestGlobals-is-null-Errors-tf2522019.html#a7034877
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org