File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Losing session between different web apps. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Losing session between different web apps." Watch "Losing session between different web apps." New topic

Losing session between different web apps.

Alaa Abutabaq

Joined: Jan 15, 2002
Posts: 18
I'm facing a problem in tracking session between different webapps. When i request from a page in a web app to a page in a diff web app, I lose the session.I use Sun one web server 6.1. Is there a way to keep tracking sessions between web apps?
Thanks in advance
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

When you say "web app", I assume you mean a separate web context and not a single context on separate machines?

If you are, then sessions don't work that way. A session is specific to an application context, and while the session ID in some containers may be the same between contexts, the session itself is not. It is possible to create messages between web applications, but you may find it better to have a 'common area' such as shared Database or business tier to allow the applications to communicate.

Be careful that you don't try to replicate the session's responsibility though. Doing so is dangerous since it may not be completely compatible with the existing session mananger and prevent clustering, or it may cause the original session manager to become unstable.

I hope this helps.
Alaa Abutabaq

Joined: Jan 15, 2002
Posts: 18
Thanks very much for your help. I think about that, but i wished if i have a way to use the same session. It seems there is no way.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
There are very good reasons why you can't, security being prime among them.

I agree. Here's the link:
subject: Losing session between different web apps.
It's not a secret anymore!