You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ma...@j-b-s.de on 2008/04/07 12:45:06 UTC

Access ASO / ASM directly

Hi all!

I am using ACEGI and the T5 integration which works well. To simplify the code I tried to store the "user" in the application state object which allows all pages access to this object just by the @Inject annotation.

Unfortunately when retrieving the user from the DB and trying to save the login result a NullPointerException occurs because the "_request" member in "SessionApplicationStatePersistenceStrategy" is not set yet (see below). 

Via AppModule I injected the ApplicationStateManger to my ACEGI authenticaten provider which seems to work (proxy instance passed as parameter, not null). But the next line causes the NPE:

_applicationStateManager.set(AcegiDomainUser.class, (AcegiDomainUser)userDetails);  

I assume that the acegi authentication provider runs within the ACEGI filter and the T5 objects are not properly setup at this time. Is there a place where I can safely access ASM and how to pass the information from the authentication provider to T5? 

Thanks in advance

Jens




USER=AcegiDomainUser@ddd8be
ASM=<Proxy for ApplicationStateManager(org.apache.tapestry.services.ApplicationStateManager)>

07.04.2008 11:53:15 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
	at $Request_119284d5f17.getSession($Request_119284d5f17.java)
	at $Request_119284d5ee2.getSession($Request_119284d5ee2.java)
	at org.apache.tapestry.internal.services.SessionApplicationStatePersistenceStrategy.getSession(SessionApplicationStatePersistenceStrategy.java:42)
	at org.apache.tapestry.internal.services.SessionApplicationStatePersistenceStrategy.set(SessionApplicationStatePersistenceStrategy.java:72)
	at org.apache.tapestry.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter.set(ApplicationStateManagerImpl.java:50)
	at org.apache.tapestry.internal.services.ApplicationStateManagerImpl.set(ApplicationStateManagerImpl.java:138)
	at $ApplicationStateManager_119284d5f28.set($ApplicationStateManager_119284d5f28.java)

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


Re: Access ASO / ASM directly

Posted by Peter Stavrinides <p....@albourne.com>.
Not sure what you are trying to do exactly, but it may help to know you 
should use the @ApplicationState annotation for ASO's and not @Inject. 
You may only use inject if you have created a service and used the 
ApplicationStateManager as a service dependency in the construction of 
the service.

mailinglist@j-b-s.de wrote:
> Hi all!
>
> I am using ACEGI and the T5 integration which works well. To simplify the code I tried to store the "user" in the application state object which allows all pages access to this object just by the @Inject annotation.
>
> Unfortunately when retrieving the user from the DB and trying to save the login result a NullPointerException occurs because the "_request" member in "SessionApplicationStatePersistenceStrategy" is not set yet (see below). 
>
> Via AppModule I injected the ApplicationStateManger to my ACEGI authenticaten provider which seems to work (proxy instance passed as parameter, not null). But the next line causes the NPE:
>
> _applicationStateManager.set(AcegiDomainUser.class, (AcegiDomainUser)userDetails);  
>
> I assume that the acegi authentication provider runs within the ACEGI filter and the T5 objects are not properly setup at this time. Is there a place where I can safely access ASM and how to pass the information from the authentication provider to T5? 
>
> Thanks in advance
>
> Jens
>
>
>
>
> USER=AcegiDomainUser@ddd8be
> ASM=<Proxy for ApplicationStateManager(org.apache.tapestry.services.ApplicationStateManager)>
>
> 07.04.2008 11:53:15 org.apache.catalina.core.StandardWrapperValve invoke
> SCHWERWIEGEND: Servlet.service() for servlet default threw exception
> java.lang.NullPointerException
> 	at $Request_119284d5f17.getSession($Request_119284d5f17.java)
> 	at $Request_119284d5ee2.getSession($Request_119284d5ee2.java)
> 	at org.apache.tapestry.internal.services.SessionApplicationStatePersistenceStrategy.getSession(SessionApplicationStatePersistenceStrategy.java:42)
> 	at org.apache.tapestry.internal.services.SessionApplicationStatePersistenceStrategy.set(SessionApplicationStatePersistenceStrategy.java:72)
> 	at org.apache.tapestry.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter.set(ApplicationStateManagerImpl.java:50)
> 	at org.apache.tapestry.internal.services.ApplicationStateManagerImpl.set(ApplicationStateManagerImpl.java:138)
> 	at $ApplicationStateManager_119284d5f28.set($ApplicationStateManager_119284d5f28.java)
>
> ---------------------------------------------------------------------
> 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