You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mike Helmick <he...@cs.xu.edu> on 2004/05/19 05:02:53 UTC

sessions

Hi,

I'm fairly new to Tapestry and am just now working on my first  
non-trivial application.

What I really want to do is maintain information about an individual  
user's navigation scope in the visit object.
The problem is, the scope is getting reset to default on every page  
request.

Also, if I start a session and click the home link on that page, a new  
session is started.

I have proven this by adding a simple counter to the visit object and  
displaying it's contents on the page, and it is always coming back 1,  
event if I reload the same page over and over.

Each page is contained in a custom Border component that handles the  
main page design and each page renders in the "content" pane.

In the Border.java class, I have this method to set the appropriate  
session for this render
     public void pageBeginRender(PageEvent event)
     {
         visit = (Visit) getPage().getVisit();

		visit.visit(); // increment counter for test reasons
	}

It just does not seem that the Visit instance is being persisted to the  
HttpSession even though one is started on each request (can see this in  
Tomcat manager)

What am I doing wrong, or not doing at all that would provide the same  
instance of Visit between requests?

thanks,
mike helmick

------------------------------------------------------------------------ 
----------------------
Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
Ph.D. Student - University of Cincinnati, College of Engineering
Senior Consultant, Cardinal Solutions Group - Enterprise Java Solutions
------------------------------------------------------------------------ 
----------------------
Help stamp out and abolish redundancy.

Re: sessions

Posted by Mike Helmick <he...@cs.xu.edu>.
My session problem is now back, only it is happening on all of my Java  
applications.

Looking at the .ser files, I can see tha tTomcat is writing out the  
session data but it is never reading it back

A simple JSP that does nothing but spit out the session number, prints  
a different one each time, even from the same browser.

Has anyone see this behavior from tomcat (I tried both 4 and 5)?

help is much appreciated so that I can stop fusing with the container  
and get back to Tapestry.

mike h

------------------------------------------------------------------------ 
----------------------
Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
Ph.D. Student - University of Cincinnati, College of Engineering
Senior Consultant, Cardinal Solutions Group - Enterprise Java Solutions
------------------------------------------------------------------------ 
----------------------
Help stamp out and abolish redundancy.
On May 20, 2004, at 2:49 PM, tmjee wrote:

> Hi Mike,
>
> Thanks for sharing the information. I am using Tomcat, and i think,  
> the last
> time I encounter this problem, there was something like a
> NotSerializableException being logged in the tomcat log (may be
> localhost_log, not sure of I have changed tomcat's server.xml).
>
> I think with the default engine, visit object would be initialised  
> lazily
> upon first request, someone do correct me if I am wrong, so I didn't  
> do any
> initialisation, not sure if this is the appropriate way. :-)
>
> regards
>
> ----- Original Message -----
> From: "Mike Helmick" <he...@cs.xu.edu>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, May 19, 2004 4:30 AM
> Subject: Re: sessions
>
>
>>
>> tmjee,
>>
>> I went back and rechecked, and I was including a class in my visit
>> object that included a class as a member that was not serializable.
>> So that was the problem. - Although I never saw a serilization
>> exception, would have expected one of those on the console.
>>
>> I also made a change so that the Home page is now a PageRenderListener
>> and am instantiating the visit object there first, rather than first
>> accessing it in an included component.
>>
>> at any rate, it is working now,
>>
>> thanks,
>> mike h
>>
>>
>> ---------------------------------------------------------------------- 
>> --
>> ----------------------
>> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
>> Ph.D. Student - University of Cincinnati, College of Engineering
>> Senior Consultant, Cardinal Solutions Group - Enterprise Java  
>> Solutions
>> ---------------------------------------------------------------------- 
>> --
>> ----------------------
>> Help stamp out and abolish redundancy.
>> On May 19, 2004, at 4:04 PM, tmjee wrote:
>>
>>> Hi Mike,
>>>
>>> Are you using BaseEngine (the default)? It works ok for me, the visit
>>> object
>>> is persisted ok in session and so are the stuff in visit (they are  
>>> all
>>> serializable).
>>>
>>> regards
>>> tmjee
>>>
>>> ----- Original Message -----
>>> From: "Mike Helmick" <he...@cs.xu.edu>
>>> To: "Tapestry users" <ta...@jakarta.apache.org>
>>> Sent: Tuesday, May 18, 2004 7:02 PM
>>> Subject: sessions
>>>
>>>
>>>>
>>>> Hi,
>>>>
>>>> I'm fairly new to Tapestry and am just now working on my first
>>>> non-trivial application.
>>>>
>>>> What I really want to do is maintain information about an individual
>>>> user's navigation scope in the visit object.
>>>> The problem is, the scope is getting reset to default on every page
>>>> request.
>>>>
>>>> Also, if I start a session and click the home link on that page, a  
>>>> new
>>>> session is started.
>>>>
>>>> I have proven this by adding a simple counter to the visit object  
>>>> and
>>>> displaying it's contents on the page, and it is always coming back  
>>>> 1,
>>>> event if I reload the same page over and over.
>>>>
>>>> Each page is contained in a custom Border component that handles the
>>>> main page design and each page renders in the "content" pane.
>>>>
>>>> In the Border.java class, I have this method to set the appropriate
>>>> session for this render
>>>>      public void pageBeginRender(PageEvent event)
>>>>      {
>>>>          visit = (Visit) getPage().getVisit();
>>>>
>>>> visit.visit(); // increment counter for test reasons
>>>> }
>>>>
>>>> It just does not seem that the Visit instance is being persisted to
>>>> the
>>>> HttpSession even though one is started on each request (can see this
>>>> in
>>>> Tomcat manager)
>>>>
>>>> What am I doing wrong, or not doing at all that would provide the  
>>>> same
>>>> instance of Visit between requests?
>>>>
>>>> thanks,
>>>> mike helmick
>>>>
>>>> -------------------------------------------------------------------- 
>>>> --
>>>> --
>>>> ----------------------
>>>> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
>>>> Ph.D. Student - University of Cincinnati, College of Engineering
>>>> Senior Consultant, Cardinal Solutions Group - Enterprise Java
>>>> Solutions
>>>> -------------------------------------------------------------------- 
>>>> --
>>>> --
>>>> ----------------------
>>>> Help stamp out and abolish redundancy.
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> tapestry-user-help@jakarta.apache.org
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>

Re: sessions

Posted by tmjee <tm...@hotmail.com>.
Hi Mike,

Thanks for sharing the information. I am using Tomcat, and i think, the last
time I encounter this problem, there was something like a
NotSerializableException being logged in the tomcat log (may be
localhost_log, not sure of I have changed tomcat's server.xml).

I think with the default engine, visit object would be initialised lazily
upon first request, someone do correct me if I am wrong, so I didn't do any
initialisation, not sure if this is the appropriate way. :-)

regards

----- Original Message -----
From: "Mike Helmick" <he...@cs.xu.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, May 19, 2004 4:30 AM
Subject: Re: sessions


>
> tmjee,
>
> I went back and rechecked, and I was including a class in my visit
> object that included a class as a member that was not serializable.
> So that was the problem. - Although I never saw a serilization
> exception, would have expected one of those on the console.
>
> I also made a change so that the Home page is now a PageRenderListener
> and am instantiating the visit object there first, rather than first
> accessing it in an included component.
>
> at any rate, it is working now,
>
> thanks,
> mike h
>
>
> ------------------------------------------------------------------------
> ----------------------
> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
> Ph.D. Student - University of Cincinnati, College of Engineering
> Senior Consultant, Cardinal Solutions Group - Enterprise Java Solutions
> ------------------------------------------------------------------------
> ----------------------
> Help stamp out and abolish redundancy.
> On May 19, 2004, at 4:04 PM, tmjee wrote:
>
> > Hi Mike,
> >
> > Are you using BaseEngine (the default)? It works ok for me, the visit
> > object
> > is persisted ok in session and so are the stuff in visit (they are all
> > serializable).
> >
> > regards
> > tmjee
> >
> > ----- Original Message -----
> > From: "Mike Helmick" <he...@cs.xu.edu>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Tuesday, May 18, 2004 7:02 PM
> > Subject: sessions
> >
> >
> >>
> >> Hi,
> >>
> >> I'm fairly new to Tapestry and am just now working on my first
> >> non-trivial application.
> >>
> >> What I really want to do is maintain information about an individual
> >> user's navigation scope in the visit object.
> >> The problem is, the scope is getting reset to default on every page
> >> request.
> >>
> >> Also, if I start a session and click the home link on that page, a new
> >> session is started.
> >>
> >> I have proven this by adding a simple counter to the visit object and
> >> displaying it's contents on the page, and it is always coming back 1,
> >> event if I reload the same page over and over.
> >>
> >> Each page is contained in a custom Border component that handles the
> >> main page design and each page renders in the "content" pane.
> >>
> >> In the Border.java class, I have this method to set the appropriate
> >> session for this render
> >>      public void pageBeginRender(PageEvent event)
> >>      {
> >>          visit = (Visit) getPage().getVisit();
> >>
> >> visit.visit(); // increment counter for test reasons
> >> }
> >>
> >> It just does not seem that the Visit instance is being persisted to
> >> the
> >> HttpSession even though one is started on each request (can see this
> >> in
> >> Tomcat manager)
> >>
> >> What am I doing wrong, or not doing at all that would provide the same
> >> instance of Visit between requests?
> >>
> >> thanks,
> >> mike helmick
> >>
> >> ----------------------------------------------------------------------
> >> --
> >> ----------------------
> >> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
> >> Ph.D. Student - University of Cincinnati, College of Engineering
> >> Senior Consultant, Cardinal Solutions Group - Enterprise Java
> >> Solutions
> >> ----------------------------------------------------------------------
> >> --
> >> ----------------------
> >> Help stamp out and abolish redundancy.
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>

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


Re: sessions

Posted by Mike Helmick <he...@cs.xu.edu>.
tmjee,

I went back and rechecked, and I was including a class in my visit  
object that included a class as a member that was not serializable.
So that was the problem. - Although I never saw a serilization  
exception, would have expected one of those on the console.

I also made a change so that the Home page is now a PageRenderListener  
and am instantiating the visit object there first, rather than first  
accessing it in an included component.

at any rate, it is working now,

thanks,
mike h


------------------------------------------------------------------------ 
----------------------
Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
Ph.D. Student - University of Cincinnati, College of Engineering
Senior Consultant, Cardinal Solutions Group - Enterprise Java Solutions
------------------------------------------------------------------------ 
----------------------
Help stamp out and abolish redundancy.
On May 19, 2004, at 4:04 PM, tmjee wrote:

> Hi Mike,
>
> Are you using BaseEngine (the default)? It works ok for me, the visit  
> object
> is persisted ok in session and so are the stuff in visit (they are all
> serializable).
>
> regards
> tmjee
>
> ----- Original Message -----
> From: "Mike Helmick" <he...@cs.xu.edu>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, May 18, 2004 7:02 PM
> Subject: sessions
>
>
>>
>> Hi,
>>
>> I'm fairly new to Tapestry and am just now working on my first
>> non-trivial application.
>>
>> What I really want to do is maintain information about an individual
>> user's navigation scope in the visit object.
>> The problem is, the scope is getting reset to default on every page
>> request.
>>
>> Also, if I start a session and click the home link on that page, a new
>> session is started.
>>
>> I have proven this by adding a simple counter to the visit object and
>> displaying it's contents on the page, and it is always coming back 1,
>> event if I reload the same page over and over.
>>
>> Each page is contained in a custom Border component that handles the
>> main page design and each page renders in the "content" pane.
>>
>> In the Border.java class, I have this method to set the appropriate
>> session for this render
>>      public void pageBeginRender(PageEvent event)
>>      {
>>          visit = (Visit) getPage().getVisit();
>>
>> visit.visit(); // increment counter for test reasons
>> }
>>
>> It just does not seem that the Visit instance is being persisted to  
>> the
>> HttpSession even though one is started on each request (can see this  
>> in
>> Tomcat manager)
>>
>> What am I doing wrong, or not doing at all that would provide the same
>> instance of Visit between requests?
>>
>> thanks,
>> mike helmick
>>
>> ---------------------------------------------------------------------- 
>> --
>> ----------------------
>> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
>> Ph.D. Student - University of Cincinnati, College of Engineering
>> Senior Consultant, Cardinal Solutions Group - Enterprise Java  
>> Solutions
>> ---------------------------------------------------------------------- 
>> --
>> ----------------------
>> Help stamp out and abolish redundancy.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>

Re: sessions

Posted by tmjee <tm...@hotmail.com>.
Hi Mike,

Are you using BaseEngine (the default)? It works ok for me, the visit object
is persisted ok in session and so are the stuff in visit (they are all
serializable).

regards
tmjee

----- Original Message -----
From: "Mike Helmick" <he...@cs.xu.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, May 18, 2004 7:02 PM
Subject: sessions


>
> Hi,
>
> I'm fairly new to Tapestry and am just now working on my first
> non-trivial application.
>
> What I really want to do is maintain information about an individual
> user's navigation scope in the visit object.
> The problem is, the scope is getting reset to default on every page
> request.
>
> Also, if I start a session and click the home link on that page, a new
> session is started.
>
> I have proven this by adding a simple counter to the visit object and
> displaying it's contents on the page, and it is always coming back 1,
> event if I reload the same page over and over.
>
> Each page is contained in a custom Border component that handles the
> main page design and each page renders in the "content" pane.
>
> In the Border.java class, I have this method to set the appropriate
> session for this render
>      public void pageBeginRender(PageEvent event)
>      {
>          visit = (Visit) getPage().getVisit();
>
> visit.visit(); // increment counter for test reasons
> }
>
> It just does not seem that the Visit instance is being persisted to the
> HttpSession even though one is started on each request (can see this in
> Tomcat manager)
>
> What am I doing wrong, or not doing at all that would provide the same
> instance of Visit between requests?
>
> thanks,
> mike helmick
>
> ------------------------------------------------------------------------
> ----------------------
> Michael T Helmick,  M.S. 2004 NKU, B.S. 2000 XU
> Ph.D. Student - University of Cincinnati, College of Engineering
> Senior Consultant, Cardinal Solutions Group - Enterprise Java Solutions
> ------------------------------------------------------------------------
> ----------------------
> Help stamp out and abolish redundancy.
>

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