Session lost after each servlet request

If you access the web application via http://localhost then cookies might not be accepted. Thus session could be lost. This happens with netbeans and tomcat after a single logout has been executed.

A solution would be to use http://machinename.localdomain or http://localhost.localdomain or any other local domain if one has been configured.

Alternatively, you can configure to your local computer with the following steps:

  1. add line “” to /etc/hosts (linux). For windows read this article
  2. configure netbeans to use instead of localhost

You don’t need to actually configure netbeans to use, since you can simply type the path manually but it is better to do so.



Modify your hosts file

Session is lost and created as new in every servlet request



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s