You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2009/09/08 19:59:09 UTC

Re: NPE when trying to store an ASO

Hey Uli & others,

I dug up this old thread as I run into the same issue myself with
T5.1. Did you ever manage to solve this in a satisfactory way? It's
clear that the issue is the same - requestGlobals.getRequest() returns
null since I'm contributing my handler before everything else but I
also want to create a sessionstate object. It's entirely possible that
things have changed since and I simply should be contributing my
handler right after the handler (if so, named what?) that stores the
request globals objects but I didn't check yet. Is there any better
workaround than Thiago's httpSession.set("aso:" +
User.class.getName(), user)?

Kalle


On Thu, Oct 9, 2008 at 12:06 PM, Ulrich Stärk<ul...@spielviel.de> wrote:
> Ok, I think I know what's going on. I think the service I'm decorating is
> being called before the terminator of the HttpServletRequestHandler pipeline
> makes the Request available. In a mail from december 2007 Peter Stavrinides
> seems to have stumbled over the same issue:
> http://markmail.org/message/4qup7wyjsb7kavy3
>
> Howard, you mentioned the possibility to change this and there is also an
> open issue for one of the impacts of this
> (https://issues.apache.org/jira/browse/TAP5-257). Should I open an issue for
> populating the Request and Response earlier on in the pipeline?
>
> Cheers,
>
> Uli
>
>
> Ulrich Stärk schrieb:
>>
>> I'm decorating one of my services in order to store the result of a method
>> call as an ASO. I therefore inject the ApplicationStatemanager service into
>> my decorator implementation and call
>> applicationStateManager.set(UserDetails.class, (UserDetails) o);, but I
>> always get the NullPointerException below. Is what I'm doing supposed to
>> work and am I seeing a bug or should I do this somehow different?
>>
>> Cheers,
>>
>> Uli
>>
>> java.lang.NullPointerException
>>    at $Request_11ce2775261.getSession($Request_11ce2775261.java)
>>    at $Request_11ce2775226.getSession($Request_11ce2775226.java)
>>    at
>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.getSession(SessionApplicationStatePersistenceStrategy.java:47)
>>    at
>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.set(SessionApplicationStatePersistenceStrategy.java:88)
>>    at
>> $ApplicationStatePersistenceStrategy_11ce2775316.set($ApplicationStatePersistenceStrategy_11ce2775316.java)
>>    at
>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter.set(ApplicationStateManagerImpl.java:50)
>>    at
>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl.set(ApplicationStateManagerImpl.java:138)
>>    at
>> $ApplicationStateManager_11ce2775276.set($ApplicationStateManager_11ce2775276.java)
>>    at
>> de.spielviel.mailadmin.services.impl.UserDetailsDecoratorImpl$1.advise(UserDetailsDecoratorImpl.java:43)
>>    at
>> org.apache.tapestry5.ioc.internal.services.AbstractInvocation.proceed(AbstractInvocation.java:121)
>>    at
>> $UserDetailsService_11ce2775313.loadUserByUsername($UserDetailsService_11ce2775313.java)
>>    at
>> $UserDetailsService_11ce2775242.loadUserByUsername($UserDetailsService_11ce2775242.java)
>>    at
>> org.springframework.security.providers.openid.OpenIDAuthenticationProvider.authenticate(OpenIDAuthenticationProvider.java:70)
>>    at
>> org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
>>    at
>> org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
>>    at
>> $AuthenticationManager_11ce2775218.authenticate($AuthenticationManager_11ce2775218.java)
>>    at
>> org.springframework.security.ui.openid.OpenIDAuthenticationProcessingFilter.attemptAuthentication(OpenIDAuthenticationProcessingFilter.java:84)
>>    at
>> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:252)
>>    at
>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>>    at
>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper.service(HttpServletRequestFilterWrapper.java:52)
>>    at
>> $HttpServletRequestFilter_11ce277523f.service($HttpServletRequestFilter_11ce277523f.java)
>>    at
>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>    at
>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper$1.doFilter(HttpServletRequestFilterWrapper.java:56)
>>    at
>> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
>>    at
>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>>    at
>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper.service(HttpServletRequestFilterWrapper.java:52)
>>    at
>> $HttpServletRequestFilter_11ce2775238.service($HttpServletRequestFilter_11ce2775238.java)
>>    at
>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>    at
>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>    at
>> $HttpServletRequestFilter_11ce2775237.service($HttpServletRequestFilter_11ce2775237.java)
>>    at
>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>    at
>> $HttpServletRequestHandler_11ce2775236.service($HttpServletRequestHandler_11ce2775236.java)
>>    at
>> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>    at
>> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>>    at
>> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
>>    at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>    at
>> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
>>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
>>    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
>>    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
>>    at
>> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
>>    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>>    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: NPE when trying to store an ASO

Posted by Kalle Korhonen <ka...@gmail.com>.
Peaked into the source.. the filter responsible for storing the
objects is named "StoreIntoGlobals". However, I just couldn't get it
to work properly by trying to position my existing filter differently,
partly because I'm also using a request decorator that is dependent on
the filter. Solved it by contributing another filter to the end of
pipeline (just before the page render) which is responsible for
creating the sessionstate object. Makes some sense to me and helps
keeping the responsibilities separate. Finally, if anybody is reading
this - is there are way set @SessionState(create=false) as a default?
Couldn't find any symbol for it in the documentation.

Kalle


On Tue, Sep 8, 2009 at 10:59 AM, Kalle
Korhonen<ka...@gmail.com> wrote:
> Hey Uli & others,
>
> I dug up this old thread as I run into the same issue myself with
> T5.1. Did you ever manage to solve this in a satisfactory way? It's
> clear that the issue is the same - requestGlobals.getRequest() returns
> null since I'm contributing my handler before everything else but I
> also want to create a sessionstate object. It's entirely possible that
> things have changed since and I simply should be contributing my
> handler right after the handler (if so, named what?) that stores the
> request globals objects but I didn't check yet. Is there any better
> workaround than Thiago's httpSession.set("aso:" +
> User.class.getName(), user)?
>
> Kalle
>
>
> On Thu, Oct 9, 2008 at 12:06 PM, Ulrich Stärk<ul...@spielviel.de> wrote:
>> Ok, I think I know what's going on. I think the service I'm decorating is
>> being called before the terminator of the HttpServletRequestHandler pipeline
>> makes the Request available. In a mail from december 2007 Peter Stavrinides
>> seems to have stumbled over the same issue:
>> http://markmail.org/message/4qup7wyjsb7kavy3
>>
>> Howard, you mentioned the possibility to change this and there is also an
>> open issue for one of the impacts of this
>> (https://issues.apache.org/jira/browse/TAP5-257). Should I open an issue for
>> populating the Request and Response earlier on in the pipeline?
>>
>> Cheers,
>>
>> Uli
>>
>>
>> Ulrich Stärk schrieb:
>>>
>>> I'm decorating one of my services in order to store the result of a method
>>> call as an ASO. I therefore inject the ApplicationStatemanager service into
>>> my decorator implementation and call
>>> applicationStateManager.set(UserDetails.class, (UserDetails) o);, but I
>>> always get the NullPointerException below. Is what I'm doing supposed to
>>> work and am I seeing a bug or should I do this somehow different?
>>>
>>> Cheers,
>>>
>>> Uli
>>>
>>> java.lang.NullPointerException
>>>    at $Request_11ce2775261.getSession($Request_11ce2775261.java)
>>>    at $Request_11ce2775226.getSession($Request_11ce2775226.java)
>>>    at
>>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.getSession(SessionApplicationStatePersistenceStrategy.java:47)
>>>    at
>>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.set(SessionApplicationStatePersistenceStrategy.java:88)
>>>    at
>>> $ApplicationStatePersistenceStrategy_11ce2775316.set($ApplicationStatePersistenceStrategy_11ce2775316.java)
>>>    at
>>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter.set(ApplicationStateManagerImpl.java:50)
>>>    at
>>> org.apache.tapestry5.internal.services.ApplicationStateManagerImpl.set(ApplicationStateManagerImpl.java:138)
>>>    at
>>> $ApplicationStateManager_11ce2775276.set($ApplicationStateManager_11ce2775276.java)
>>>    at
>>> de.spielviel.mailadmin.services.impl.UserDetailsDecoratorImpl$1.advise(UserDetailsDecoratorImpl.java:43)
>>>    at
>>> org.apache.tapestry5.ioc.internal.services.AbstractInvocation.proceed(AbstractInvocation.java:121)
>>>    at
>>> $UserDetailsService_11ce2775313.loadUserByUsername($UserDetailsService_11ce2775313.java)
>>>    at
>>> $UserDetailsService_11ce2775242.loadUserByUsername($UserDetailsService_11ce2775242.java)
>>>    at
>>> org.springframework.security.providers.openid.OpenIDAuthenticationProvider.authenticate(OpenIDAuthenticationProvider.java:70)
>>>    at
>>> org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
>>>    at
>>> org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
>>>    at
>>> $AuthenticationManager_11ce2775218.authenticate($AuthenticationManager_11ce2775218.java)
>>>    at
>>> org.springframework.security.ui.openid.OpenIDAuthenticationProcessingFilter.attemptAuthentication(OpenIDAuthenticationProcessingFilter.java:84)
>>>    at
>>> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:252)
>>>    at
>>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>>>    at
>>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper.service(HttpServletRequestFilterWrapper.java:52)
>>>    at
>>> $HttpServletRequestFilter_11ce277523f.service($HttpServletRequestFilter_11ce277523f.java)
>>>    at
>>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>>    at
>>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper$1.doFilter(HttpServletRequestFilterWrapper.java:56)
>>>    at
>>> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
>>>    at
>>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>>>    at
>>> nu.localhost.tapestry5.springsecurity.services.internal.HttpServletRequestFilterWrapper.service(HttpServletRequestFilterWrapper.java:52)
>>>    at
>>> $HttpServletRequestFilter_11ce2775238.service($HttpServletRequestFilter_11ce2775238.java)
>>>    at
>>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>>    at
>>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>>    at
>>> $HttpServletRequestFilter_11ce2775237.service($HttpServletRequestFilter_11ce2775237.java)
>>>    at
>>> $HttpServletRequestHandler_11ce2775241.service($HttpServletRequestHandler_11ce2775241.java)
>>>    at
>>> $HttpServletRequestHandler_11ce2775236.service($HttpServletRequestHandler_11ce2775236.java)
>>>    at
>>> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>>    at
>>> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>>>    at
>>> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>>>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>>    at
>>> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
>>>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>>    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>>    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
>>>    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
>>>    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
>>>    at
>>> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
>>>    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>>>    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

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