Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes Sharing session between different application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Sharing session between different application" Watch "Sharing session between different application" New topic

Sharing session between different application

Shanmuga Raja

Joined: Jun 14, 2004
Posts: 16
Can we have the session object shared between different application running in the apps server..say for example weblogic..?


Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33113

No. Sharing sessions across application goes against the specification.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
If you use EJB then I believe it is possible.

My blood is tested +ve for Java.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
no, it's not possible with EJB either.
2 web applications can call the same EJB which (if stateful) may be called in such a way that it uses the same EJB instance with the state left behind by the other web application but they will not share a single HttpSession.
And don't think passing the session from one webapp to another via an EJB will help you, it won't. The data referred to in that session will be useless in the webapp you pass it to and if you try to use its session ID you're in for a load of trouble.

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
I was not meant to say that you can pass session object itself between diff application.

You can pass information between different application running on the same / different servers using EJB.
I agree. Here's the link:
subject: Sharing session between different application
It's not a secret anymore!