File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes session probelm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "session probelm" Watch "session probelm" New topic

session probelm

Jacelyn Yong

Joined: Feb 16, 2005
Posts: 3
hi all,

java.lang.IllegalStateException: Cannot create a session after the response has been committed

i got this error when i try to logon to my web through my logon servlet... why this would happen & what cause this? any solution?

jacelyn (",)>
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
You are trying to create a session after the response had been committed. Have you placed a call to flush() or close() method on the response writer before you create the session?

Once you call these, the response is sent to the client and the request is essentially considered to have been served. Also, check out if you have forwarded the request before you create the session in the servlet. One of these must be the reason.

keep smilin :: sravan<br /><a href="" target="_blank" rel="nofollow">I scribble here</a>
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

"jacelyn ysw",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

[Asking smart questions] [About Bear] [Books by Bear]
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Would you mind to post your code up, so that we can diagnose it better?

SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: session probelm
It's not a secret anymore!