Re: NPE when trying to store an ASO
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 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 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
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 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($HttpS
Re: NPE when trying to store an ASO
Em Thu, 23 Oct 2008 09:33:27 -0300, Ulrich Stärk <[EMAIL PROTECTED]> escreveu: Thiago, Hi, Ulrich! I was referring to a supposedly fixed issue, that, although it's marked as fixed, still causes this NPE. Do you really think I'd make this claim if I wasn't using the latest snapshot and made sure, that maven isn't playing tricks on me? No. And I apologise for giving the wrong answer for you. I had just trying to accomplish something similar as you you're tring (setting an ASO after tapestry-spring-security did its work). But I'me using RequestFilter and I've used the following trick when setting an ASO, because I had the same problem as you: httpSession.set("aso:" + User.class.getName(), user); This workaround will remain until the bug is fixed. I'm sorry for answering your questionwithout looking at my code. :( -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NPE when trying to store an ASO
Thiago, I was referring to a supposedly fixed issue, that, although it's marked as fixed, still causes this NPE. Do you really think I'd make this claim if I wasn't using the latest snapshot and made sure, that maven isn't playing tricks on me? Uli Thiago H. de Paula Figueiredo schrieb: Em Thu, 23 Oct 2008 06:32:59 -0300, Ulrich Stärk <[EMAIL PROTECTED]> escreveu: And here is the Exception :) java.lang.NullPointerException at $Request_11d24c24553.getSession($Request_11d24c24553.java) Upgrade to 5.0.16-SNAPSHOT, as it has a fix for this bug. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NPE when trying to store an ASO
Em Thu, 23 Oct 2008 06:32:59 -0300, Ulrich Stärk <[EMAIL PROTECTED]> escreveu: And here is the Exception :) java.lang.NullPointerException at $Request_11d24c24553.getSession($Request_11d24c24553.java) Upgrade to 5.0.16-SNAPSHOT, as it has a fix for this bug. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NPE when trying to store an ASO
Ulrich Stärk schrieb: Although https://issues.apache.org/jira/browse/TAP5-257 has been fixed, I am still getting a NPE when I try to store an ASO into the session from within a HttpServletRequestFilter. I've got a HttpServletRequestFilter that handles OpenID authentication in conjunction with tapestry-spring-security. That filter calls a service (UserDetailsService) that looks up the user in a local data store. I decorated the UserDetailsService in order to store the result of the lookup call as an ASO. I therefore inject the ApplicationStateManager into my decorator and call applicationStateManager.set(...). Unfortunately I get the below NPE. I thought this was solved with TAP5-257 but it seems to be still there. Anyone any ideas? Uli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] And here is the Exception :) java.lang.NullPointerException at $Request_11d24c24553.getSession($Request_11d24c24553.java) at $Request_11d24c24518.getSession($Request_11d24c24518.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_11d24c2460b.set($ApplicationStatePersistenceStrategy_11d24c2460b.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_11d24c24569.set($ApplicationStateManager_11d24c24569.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_11d24c24608.loadUserByUsername($UserDetailsService_11d24c24608.java) at $UserDetailsService_11d24c24534.loadUserByUsername($UserDetailsService_11d24c24534.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_11d24c24509.authenticate($AuthenticationManager_11d24c24509.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_11d24c24531.service($HttpServletRequestFilter_11d24c24531.java) at $HttpServletRequestHandler_11d24c24533.service($HttpServletRequestHandler_11d24c24533.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_11d24c24529.service($HttpServletRequestFilter_11d24c24529.java) at $HttpServletRequestHandler_11d24c24533.service($HttpServletRequestHandler_11d24c24533.java) at $HttpServletRequestHandler_11d24c24528.service($HttpServletRequestHandler_11d24c24528.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
Re: NPE when trying to store an ASO
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(WebApplica