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

servlet communication between two JVMs

Javed Sardar
Ranch Hand

Joined: Sep 10, 2002
Posts: 33
I have a scenario where I have a servlet running in app servers context and another servlet running in web servers context. I am using iPlanet 6.5 app server and iPLanet 4.1 web server.
The problem comes when the servlet in app server invokes the servlet in web server. It works fine but there is no way for user authentication . Any user can directly acces the servlet on web server whith out loggin in which is done through the servlet in app server.
Dose any body have idea how to make two serlets communicate if they are running on diif JVMs ?
I am using two servlets as I have to call CSP(Crystal Server pages and )and these are accessible through web server only.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 672
Have you looked into ServletContext.getContext()?

We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You have described a situation with two separate ServletContexts - Sun explicitly prevents sharing of information between "web applications' - its a security thing.
The two JVMs can talk to each other with sockets, Java Message Service, URLConnections, whatever, but you will have to go outside the Servlet API to do it.
If the web server servlet only talks to the app server, you could simply have it reject all connections that don't come from the right source.
Vasudha Deepak
Ranch Hand

Joined: Mar 15, 2002
Posts: 86
You may wish to try making the application distributable in your deployment descriptor:


IBM Certified Developer -XML and Related Technologies(141)<br />SCJP2 SCWCD
I agree. Here's the link:
subject: servlet communication between two JVMs
It's not a secret anymore!