Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore

o.k. so it doesn't have to work... It doesn't look like there is any way to
get to the Hivemind Registry until it has completely initialized ... which
is too late. So I am going to have my stateObjectFactory check to see if it
can get to the registry which is a little bit hacky and if it can't then
create a session object that it tracks itself rather than using the
applicationStateManager.

There should be a better way!


On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote:


I have given myself 1 more hour before I use my fallback solution. But it
is just one of those things that you say "there *has* to be a way to make it
work!" :-)

-Pat

On 9/26/06, Ben Dotte <[EMAIL PROTECTED]> wrote:
>
> I remember spending an afternoon with a coworker once trying to do the
> same thing, feed a fake request/session to Tapestry for some similar
> reason. After a few hours we decided it was a silly idea and gave up on
> it... but good luck!
>
> Ben
>
>



Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore

I have given myself 1 more hour before I use my fallback solution. But it is
just one of those things that you say "there *has* to be a way to make it
work!" :-)

-Pat

On 9/26/06, Ben Dotte <[EMAIL PROTECTED]> wrote:


I remember spending an afternoon with a coworker once trying to do the
same thing, feed a fake request/session to Tapestry for some similar
reason. After a few hours we decided it was a silly idea and gave up on
it... but good luck!

Ben




RE: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Ben Dotte
I remember spending an afternoon with a coworker once trying to do the
same thing, feed a fake request/session to Tapestry for some similar
reason. After a few hours we decided it was a silly idea and gave up on
it... but good luck!

Ben

-Original Message-
From: Patrick Moore [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 26, 2006 1:29 PM
To: Tapestry users
Subject: Re: problems getting a session state object on start up (resend
..? )

Hi Ben --

What I am trying to do is preload some sample data, *as if* a user has
entered it. So I want to have a Session object that I am going to
programatically configure. Also I will be doing some background
processing
on behalf of a user so I will need to have a session object for that
case as
well. In neither case do I have a HttpRequest

-Pat

On 9/26/06, Ben Dotte <[EMAIL PROTECTED]> wrote:
>
> I hope that works for you, unfortunately I'm out of ideas on this one.
> I'm not sure what you're trying to do makes sense, if I understand
this
> correctly. It sounds like you are trying to directly access a
> session-scoped ASO as your eager-loaded service gets created, correct?
> The problem is you aren't going to have a web session without an
> associated request from the user, which isn't going to be there at the
> point the Hivemind registry is created.
>
> In my case, I needed to eager-load a service that needed the
asoManager,
> but I didn't actually pull any ASOs out of it until later while
> processing user requests.
>
> If you're trying to setup some initial state in each ASO as it is
> created, couldn't you add an initialize() method to the ASO class and
> create it using ?
>
> Sorry I don't have a better answer for you,
>
> Ben
>
> -Original Message-
> From: Patrick Moore [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 26, 2006 1:10 PM
> To: Tapestry users
> Subject: Re: problems getting a session state object on start up
(resend
> ..? )
>
> I ran across an email thread that just suggested to create the
> WebRequest/WebSession objects. So I am going to try that. If anyone
has
> a
> better idea let me know.
>
> On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote:
> >
> > Hi Ben ---
> >
> > thanks for this info.
> >
> > I just tried what I think is your suggestion. I added the
> > ApplicationInitializer interface to my demo.Samples service and
added
> this
> > method:
> >
> > public void initialize(HttpServlet arg0) {
> > try {
> > init();
> > } catch (IOException e) {
> > e.printStackTrace();
> > }
> > }
> >  and it doesn't seem to work quite completely. I get past the point
of
> the
> > infrastructure object ApplicationStateManager not being available.
> However,
> > now I get a different exception.
> >
> > How does tapestry initialize a session? Is it possible for a
> background
> > thread to initialize a tapestry session?
> >
> > --
> > java.lang.NullPointerException: Property 'webRequest' of  for
> > tapestry.globals.RequestGlobals(
> > org.apache.tapestry.services.RequestGlobals)> is null.
> > at
> >
>
$WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.j
> ava)
> >
> > at
> $WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
> > at
> $WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
> > at
> $WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
> > at
> org.apache.tapestry.engine.state.SessionScopeManager.getSession(
> > SessionScopeManager.java:48)
> > at org.apache.tapestry.engine.state.SessionScopeManager.get(
> > SessionScopeManager.java:64)
> > at
> >
>
$StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceMa
> nager_10deb12deed.java)
> >
> > at
> >
>
$StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceMa
> nager_10deb12deec.java)
> > at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
> > StateObjectManagerImpl.java:50)
> > at
> org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get (
> > ApplicationStateManagerImpl.java:60)
> > at
> >
>
$ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb1
> 2de9a.java)
> > at
> >
>
$ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb1
> 2de9b.java)
> >
> > at
> >
>
com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSessi
> on
> > (TransPolSessionManagerImpl.java:46)
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore

Hi Ben --

What I am trying to do is preload some sample data, *as if* a user has
entered it. So I want to have a Session object that I am going to
programatically configure. Also I will be doing some background processing
on behalf of a user so I will need to have a session object for that case as
well. In neither case do I have a HttpRequest

-Pat

On 9/26/06, Ben Dotte <[EMAIL PROTECTED]> wrote:


I hope that works for you, unfortunately I'm out of ideas on this one.
I'm not sure what you're trying to do makes sense, if I understand this
correctly. It sounds like you are trying to directly access a
session-scoped ASO as your eager-loaded service gets created, correct?
The problem is you aren't going to have a web session without an
associated request from the user, which isn't going to be there at the
point the Hivemind registry is created.

In my case, I needed to eager-load a service that needed the asoManager,
but I didn't actually pull any ASOs out of it until later while
processing user requests.

If you're trying to setup some initial state in each ASO as it is
created, couldn't you add an initialize() method to the ASO class and
create it using ?

Sorry I don't have a better answer for you,

Ben

-Original Message-
From: Patrick Moore [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 26, 2006 1:10 PM
To: Tapestry users
Subject: Re: problems getting a session state object on start up (resend
..? )

I ran across an email thread that just suggested to create the
WebRequest/WebSession objects. So I am going to try that. If anyone has
a
better idea let me know.

On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote:
>
> Hi Ben ---
>
> thanks for this info.
>
> I just tried what I think is your suggestion. I added the
> ApplicationInitializer interface to my demo.Samples service and added
this
> method:
>
> public void initialize(HttpServlet arg0) {
> try {
> init();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>  and it doesn't seem to work quite completely. I get past the point of
the
> infrastructure object ApplicationStateManager not being available.
However,
> now I get a different exception.
>
> How does tapestry initialize a session? Is it possible for a
background
> thread to initialize a tapestry session?
>
> --
> java.lang.NullPointerException: Property 'webRequest' of  tapestry.globals.RequestGlobals(
> org.apache.tapestry.services.RequestGlobals)> is null.
> at
>
$WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.j
ava)
>
> at
$WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
> at
$WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
> at
$WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
> at
org.apache.tapestry.engine.state.SessionScopeManager.getSession(
> SessionScopeManager.java:48)
> at org.apache.tapestry.engine.state.SessionScopeManager.get(
> SessionScopeManager.java:64)
> at
>
$StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceMa
nager_10deb12deed.java)
>
> at
>
$StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceMa
nager_10deb12deec.java)
> at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
> StateObjectManagerImpl.java:50)
> at
org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get (
> ApplicationStateManagerImpl.java:60)
> at
>
$ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb1
2de9a.java)
> at
>
$ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb1
2de9b.java)
>
> at
>
com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSessi
on
> (TransPolSessionManagerImpl.java:46)
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Ben Dotte
I hope that works for you, unfortunately I'm out of ideas on this one.
I'm not sure what you're trying to do makes sense, if I understand this
correctly. It sounds like you are trying to directly access a
session-scoped ASO as your eager-loaded service gets created, correct?
The problem is you aren't going to have a web session without an
associated request from the user, which isn't going to be there at the
point the Hivemind registry is created.

In my case, I needed to eager-load a service that needed the asoManager,
but I didn't actually pull any ASOs out of it until later while
processing user requests.

If you're trying to setup some initial state in each ASO as it is
created, couldn't you add an initialize() method to the ASO class and
create it using ?

Sorry I don't have a better answer for you,

Ben

-Original Message-
From: Patrick Moore [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 26, 2006 1:10 PM
To: Tapestry users
Subject: Re: problems getting a session state object on start up (resend
..? )

I ran across an email thread that just suggested to create the
WebRequest/WebSession objects. So I am going to try that. If anyone has
a
better idea let me know.

On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote:
>
> Hi Ben ---
>
> thanks for this info.
>
> I just tried what I think is your suggestion. I added the
> ApplicationInitializer interface to my demo.Samples service and added
this
> method:
>
> public void initialize(HttpServlet arg0) {
> try {
> init();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>  and it doesn't seem to work quite completely. I get past the point of
the
> infrastructure object ApplicationStateManager not being available.
However,
> now I get a different exception.
>
> How does tapestry initialize a session? Is it possible for a
background
> thread to initialize a tapestry session?
>
> --
> java.lang.NullPointerException: Property 'webRequest' of  tapestry.globals.RequestGlobals(
> org.apache.tapestry.services.RequestGlobals)> is null.
> at
>
$WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.j
ava)
>
> at
$WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
> at
$WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
> at
$WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
> at
org.apache.tapestry.engine.state.SessionScopeManager.getSession(
> SessionScopeManager.java:48)
> at org.apache.tapestry.engine.state.SessionScopeManager.get(
> SessionScopeManager.java:64)
> at
>
$StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceMa
nager_10deb12deed.java)
>
> at
>
$StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceMa
nager_10deb12deec.java)
> at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
> StateObjectManagerImpl.java:50)
> at
org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get (
> ApplicationStateManagerImpl.java:60)
> at
>
$ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb1
2de9a.java)
> at
>
$ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb1
2de9b.java)
>
> at
>
com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSessi
on
> (TransPolSessionManagerImpl.java:46)
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore

I ran across an email thread that just suggested to create the
WebRequest/WebSession objects. So I am going to try that. If anyone has a
better idea let me know.

On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote:


Hi Ben ---

thanks for this info.

I just tried what I think is your suggestion. I added the
ApplicationInitializer interface to my demo.Samples service and added this
method:

public void initialize(HttpServlet arg0) {
try {
init();
} catch (IOException e) {
e.printStackTrace();
}
}
 and it doesn't seem to work quite completely. I get past the point of the
infrastructure object ApplicationStateManager not being available. However,
now I get a different exception.

How does tapestry initialize a session? Is it possible for a background
thread to initialize a tapestry session?

--
java.lang.NullPointerException: Property 'webRequest' of  is null.
at
$WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.java)

at $WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
at $WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
at $WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
at org.apache.tapestry.engine.state.SessionScopeManager.getSession(
SessionScopeManager.java:48)
at org.apache.tapestry.engine.state.SessionScopeManager.get(
SessionScopeManager.java:64)
at
$StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceManager_10deb12deed.java)

at
$StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceManager_10deb12deec.java)
at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
StateObjectManagerImpl.java:50)
at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get (
ApplicationStateManagerImpl.java:60)
at
$ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb12de9a.java)
at
$ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb12de9b.java)

at
com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSession
(TransPolSessionManagerImpl.java:46)




Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore

Hi Ben ---

thanks for this info.

I just tried what I think is your suggestion. I added the
ApplicationInitializer interface to my demo.Samples service and added this
method:

   public void initialize(HttpServlet arg0) {
   try {
   init();
   } catch (IOException e) {
   e.printStackTrace();
   }
   }
and it doesn't seem to work quite completely. I get past the point of the
infrastructure object ApplicationStateManager not being available. However,
now I get a different exception.

How does tapestry initialize a session? Is it possible for a background
thread to initialize a tapestry session?

--
java.lang.NullPointerException: Property 'webRequest' of 
is null.
   at
$WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.java)
   at $WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java)
   at $WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java)
   at $WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java)
   at org.apache.tapestry.engine.state.SessionScopeManager.getSession(
SessionScopeManager.java:48)
   at org.apache.tapestry.engine.state.SessionScopeManager.get(
SessionScopeManager.java:64)
   at
$StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceManager_10deb12deed.java)
   at
$StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceManager_10deb12deec.java)
   at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
StateObjectManagerImpl.java:50)
   at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get(
ApplicationStateManagerImpl.java:60)
   at
$ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb12de9a.java)
   at
$ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb12de9b.java)
   at
com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSession(
TransPolSessionManagerImpl.java:46)


RE: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Ben Dotte
Hi Pat,

We ran into a similar situation and found a workable (but not pretty) solution. 
First, you need to contribute to the ApplicationInitializers contribution point 
as described in this thread:

http://article.gmane.org/gmane.comp.java.tapestry.user/33013

But in this case you'll want to make sure your service is created after the 
ApplicationStateManager has been setup, so it should look something like this 
in hivemodule.xml:





Then set the service you want to eager-load on "MyInitializer" and call 
something on it inside the initialize() method to ensure it gets created:

public void initialize(HttpServlet servlet)
{
myEagerLoadedService.initializeMe();
}

Maybe someone else knows a better way, but this is the best I'm come up with to 
deal with the issue of eager loading services that need the infrastructure.

Ben


From: Patrick Moore [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 26, 2006 10:45 AM
To: users@tapestry.apache.org
Subject: Re: problems getting a session state object on start up (resend ..? )

Hi there --

I have a hivemind service that loads test data into my app. I use the EagerLoad 
feature of hivemind to trigger this dataload. However, I get this exception:

java.lang.IllegalStateException: The Infrastructure service has not yet been 
initialized. 
org.apache.tapestry.services
.impl.InfrastructureImpl.getProperty(InfrastructureImpl.java:292)
org.apache.tapestry.services.impl.InfrastructureImpl.getApplicationStateManager(InfrastructureImpl.java:116)
 
$Infrastructure_10de95366c1.getApplicationStateManager($Infrastructure_10de95366c1.java)
 
$Infrastructure_10de95366c0.getApplicationStateManager($Infrastructure_10de95366c0.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

The relevant hivemodule.xml snippet is:

    
        
            
     
        
            
        
     

( I have attached complete hivemodule.xml file)

In the hivemodule.xml file, does anyone know how to inject the stateObject 
itself directly without going through the applicationStateManager? I know how 
to do it on a tapestry component/page but not in hivemind.

-Pat Moore

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problems getting a session state object on start up (resend ..? )

2006-09-26 Thread Patrick Moore
Hi there --I have a hivemind service that loads test data into
my app. I use the EagerLoad feature of hivemind to trigger this
dataload. However, I get this exception:java.lang.IllegalStateException: The Infrastructure service has not yet been initialized.
org.apache.tapestry.services.impl.InfrastructureImpl.getProperty(InfrastructureImpl.java:292)org.apache.tapestry.services.impl.InfrastructureImpl.getApplicationStateManager(InfrastructureImpl.java:116)
$Infrastructure_10de95366c1.getApplicationStateManager($Infrastructure_10de95366c1.java)
$Infrastructure_10de95366c0.getApplicationStateManager($Infrastructure_10de95366c0.java)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

The relevant hivemodule.xml snippet is:                            
                                
( I have attached complete hivemodule.xml file)In the hivemodule.xml file, does anyone know how to inject the
stateObject itself directly without going through the
applicationStateManager? I know how to do it on a tapestry
component/page but not in hivemind.
-Pat Moore


	
		
		
		
		
		
	
	
  		
		
  		
	

	
		
			
			
		
	
	
		
			
			
		
			
	
		
			
			
		
	
	
		
			
	
	
			
		
	
		
		
			
  
  
			
		
	
	
		
			
	
	
	
			
		
	
	
		
			

			
		
	
	
		
			
	
	
	
			
		
	

	
		
			

	
			
		
	

	
		
			
	
	
			
		
	
	
 	
	
	
		
	


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]