This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to communicate between 2 servlets which are present in two different web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to communicate between 2 servlets which are present in two different web applications" Watch "how to communicate between 2 servlets which are present in two different web applications" New topic
Author

how to communicate between 2 servlets which are present in two different web applications

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
hi every one,

how to communicate between 2 servlets which are present in two different web applications?

case1: two web applications are deployed in the same server (for example tomcat)
case2: two web applications are deployed in two different servers (for example tomcat and weblogic)

need help


Abhishek
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
Java is loaded with tools for communicating between applications. One of the simplest would be a shared database.

What are the characteristics of the data which needs to be shared?
volume?
rapid change?
transactions?
... etc

Bill
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
actually i was asked this in an interview ....
Frank Kellinghusen
Greenhorn

Joined: Jul 10, 2009
Posts: 11
Abhishek Reddy wrote:hi every one,

how to communicate between 2 servlets which are present in two different web applications?

case1: two web applications are deployed in the same server (for example tomcat)



You can get the ServletContext of another application running in the same server using getContext(String appUrl):

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getContext%28java.lang.String%29

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Can you not try opening a HTTPURLConnection to the other servlet ?


Regards
KumarRaja

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to communicate between 2 servlets which are present in two different web applications
 
Similar Threads
Communication between servlets
Communicating Among differennt Applications in Tomcat
Doubts about Servlets and JSP(Please explain all my doubts with examples clearly)
RESTEasy communication between two Web apps
communicating between two web application