wood burning stoves 2.0*
The moose likes Servlets and the fly likes Communication between two web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between two web applications" Watch "Communication between two web applications" New topic

Communication between two web applications

Anand Sivathanu
Ranch Hand

Joined: Jun 25, 2010
Posts: 76
Hi Friends,

I need to communicate to a servlet present in another web application of the same web container.

As I googled, I found of using getServletContext().getContext("/Cart");

Current web application is "HelloWorld" and I need to commuicate to Cart.

So i invoked

But I printed the value of otherContext, it is null.

so I not able to forward the req and res.

Please help.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41106
Generally, this won't work. It can be made to work on some servlet containers via proprietary means. For Tomcat, that's what the crossContext attribute does.

Ping & DNS - my free Android networking tools app
Anand Sivathanu
Ranch Hand

Joined: Jun 25, 2010
Posts: 76
Thanks for your reply Ulf Dittmer. I will try the CrossContext
Mr. Ankur Garg

Joined: May 27, 2012
Posts: 6

In a security conscious environment, the servlet container may return null for a given URL.
just check out about security issues..

Ankur Garg (SCJP,SCWCD)
It is sorta covered in the JavaRanch Style Guide.
subject: Communication between two web applications
Similar Threads
configuring multiple application modules in struts framework
forwarding to a different webApp
How to send values from one Servlet Context to other
jsp-config does not appear to be "shared"
Scope of an HttpSession