Forums Register Login

method getAttribute throws exception

+Pie Number of slices to send: Send
Hi,
I am trying to get an attribute from the session
using (String)session.getAttribute("Name"); and the servlet throws an exception

"Server caught unhandled exception from servlet �TestServlet�: Method ( getAttribute ) invoked on HttpSession object from a thread other than the thread on which the servlet's service method was dispatched."
com.ibm.servlet.engine.webapp.UncaughtServletException: Server caught unhandled exception from servlet �TestServlet�: Method ( getAttribute ) invoked on HttpSession object from a thread other than the thread on which the servlet's service method was dispatched.
How do I solve this ?
I am using Websphere 3.5 .
Any help would be appreciated.
Thanks in advance.
Vidya
+Pie Number of slices to send: Send
Can you post a simple test case of this?
+Pie Number of slices to send: Send
Hi,
The problem no more exists. I think the problem was , I wasn't getting the existing session.
This is my code in the jsp page :
I have a javascript method :

I replaced session.getAttribute("NAME") with request.getSession(true).getAttribute("NAME")
and I don't get the exception.
I guess, the first time, it was trying to create another session object rather than using the existing one(using another thread ?)
Am I right? Any pointers are welcome.
I would appreciate it if someone could explain what was going on .
Thanks again.
Vidya.
+Pie Number of slices to send: Send
The only way I can imagine that happening would be if you kept a reference to the session as an instance variable and tried to use that from a different Thread.
Bill
It's just a flesh wound! Or a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 890 times.
Similar Threads
Servlets and Threading
long post IBM.158
doubt about servlets
Help Needed Regarding Session Management
Response already committed
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:54:17.