Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

access different context  RSS feed

 
Jet Ink
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am wondering is there a way to access the different context? Assuming there are 2 application servers in different boxes. Now what I want is to use an object in server 'A' while I am in the other server 'B'. From Jason Hunter's book, servlet programing, mentioned that it is not available while that book's print. RMI seems a solution to this, but any other way?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun has very carefully made each servlet context independent as far as the Servlet and JSP APIs are concerned so you have to use another technology. The following will let you communicate with objects in a different servlet context (but not access the context directly).
1. Roll your own socket connection with
Object serialization (or just plain byte[])
2. RMI - sockets the easy way - the basis of J2EE communication.
3. shared database server
4. JMS Java Message Service (note that message beans using JMS are part of the latest J2EE API)
5. JavaSpaces - cool but takes some getting used to.
6. SOAP or XML-RPC (XML formatted text messages representing objects)
Bill
 
Nicolas Brasseur
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about JDO ?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is that JDO (Java Data Objects) just provides an alternate interface to a database so its a special case of 3.
I am sure the ranch users would love to hear anybodies experience with JDO in a servlet setting.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!