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 Web Component Certification (SCWCD/OCPJWCD) and the fly likes Distributed 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 » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Distributed Web Applications" Watch "Distributed Web Applications" New topic
Author

Distributed Web Applications

Hasnain Javed Khan
Ranch Hand

Joined: Nov 23, 2007
Posts: 73
Hello All,

I seem to be having lots of problems in solving questions regarding distributed web applications and servlet context, servlet config etc.

Following is quoted from HFSJ


There is one ServletContext per VM.
There is one ServletConfig per servlet, per VM.


As far as I understood, if there are two JVMs, there will be two servlet contexts, two servlet configs and two instances of the same servlet per VM in total ? Am I misunderstanding the concept or missing some information ?

On page 257 of HFSJ (the two diagrams)

Note: everything is duplicated in the second server EXCEPT the HttpSession objects! Sessions live in only ONE place at any given moment. The same session ID for a given web app will NEVER appear in two VMs at the same time.


The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?

Hope my question is clear.

Kind Regards.
Hasnain Javed.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Hasnain Javed Khan wrote:As far as I understood, if there are two JVMs, there will be two servlet contexts, two servlet configs and two instances of the same servlet per VM in total ? Am I misunderstanding the concept or missing some information ?

If there are 2 JVMs, then there will be two ServletContext objects and two ServletConfig objects in total (not per VM, there will be 1 ServletConfig per VM).

Hasnain Javed Khan wrote:
Note: everything is duplicated in the second server EXCEPT the HttpSession objects! Sessions live in only ONE place at any given moment. The same session ID for a given web app will NEVER appear in two VMs at the same time.

The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?

The book is talking about HttpSession object not ServletContext...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Hasnain Javed Khan
Ranch Hand

Joined: Nov 23, 2007
Posts: 73
Hello Ankit.

Ankit Garg wrote: The book is talking about HttpSession object not ServletContext...


Yes I know the book is talking about HttpSession.What I'm talking about is the ServletContext.


The above quote is confusing me. The same Servlet Context on VM 1 will be shifted to VM 2 or there already is a Servlet Context in VM 2 ?


In the beginning of the sentence


Note: everything is duplicated in the second server


If there are two ServletContext instances in two VMs, what gets duplicated regarding the ServletContext,ServletConfig etc?

Kind Regards.
Hasnain Javed.

Patil Niteen
Ranch Hand

Joined: Dec 10, 2009
Posts: 48

Hi Hasnain Javed Khan,
It states that all the implicit objects will be duplicated(new object will be created) except the HttpSession object on the server2. The HttpSession object will be migrated from server1 to server2(session attributes should be serialized in this case for proper migration).

Thanks.

SCJP 1.4, SCWCD 5
 
jQuery in Action, 2nd edition
 
subject: Distributed Web Applications
 
Similar Threads
Defaul ServletContext ...??? Question
Session migration
question on servlet contexts
j2ee certificate ques
doubt in Sessin Migration