views:

35

answers:

1

Hi I am having scenario that I am using 4 tomcat instances on our server.When user login then suppose it is connected to tomcat-1 so we stored all session values in tomcat-1.Then we are processing paypal.After paypal processing user is get diverted to another tomcat say tomcat-2.So there are no values in session for this user.And I am facing problem.So I want to send user on same tomcat from where it comes after paypal processing so that his all session values we can fetch.

+1  A: 

Why are you using multiple Tomcat instances in a server? The best answer to this would be to use a single Tomcat instance and deploy all webapps on it and if necessary make use of virtual hosting.

If you stick to using multiple instances, then the only solution is to pass the information of interest as request parameter or pathinfo and process it accordingly. If this information is lot of data and/or complex, then store it in a shared datastore (SQL database?) and pass its identifier (primary key) value around as request parameter/pathinfo.

If you solve this by using a single Tomcat instance in the server, then you can just set the emptySessionPath attrbute of the HTTP connector <Connector> in conf/server.xml to true. This way the HttpSession will be shared among all deployed webapps.

If you actually have 4 physically independent server machines with each one Tomcat instance which each contains a backup/duplication of the webapps, then you need to create a cluster with session replication.

BalusC
Hi, I have 2 o more physically indenpendent servers with (posible) not comunication between eachothers. Is there a way to configure tomcat to share the location of the path for save and mantain sessions?
damian

related questions