Assuming that the servlet container is distributed across multiple JVMs, which of the following statements are correct?
Select 2 correct options.
A separate instance of a non-default servlet context will be available on each of the JVMs.
A separate instance of all servlet context will be avaible on each of the JVMs
The default servlet context will be present only on one of the JVMs.
There is only one instance of servlet contexts across all the JVMs.
None of the above.
As per me.. the first two that are bold are correct. Bt the answer is 1 and 3. Please explain
posted 14 years ago
This is the comment .... from someone ...
There is one instance of the ServletContext interface associated with each web application deployed into a container. In cases where the container is distributed over many virtual machines, there is one instance per web application per VM. Servlets that exist in a container that were not deployed as part of a web application are implicitly part of a �default� web application and are contained by a default ServletContext. In a distributed container, the default ServletContext is non-distributable and must only exist on one VM.
Here is my suggestion. 1. Go to the authoritative servlet API site and download the servlet API documents. 2. Search the API for default servlet context (and variations) 3. Report back to the class what you find.
There would be one context per JVM. But session is something that only one per user per application( not JVM).Imagin a cluster having a load balancer to redirect the client requests.For example the first the file load balancer redirects the request to Node 1 and for the second request from the user the load balancer directs the request to Node 2.But still the session is with Node 1..so node 1 passivated the session and sends that to node 2 , where again this gets activated. I know this is nothing much to do with your exact question. Hope this helps.
Thanks william. Yes there exists something that is the default servlet context.As per the specs..
Servlets in a container that were not deployed as part of aWeb application are implicitly part of a �default� Web application and have a default ServletContext. In a distributed container, the default ServletContext is non-distributable and must only exist in one JVM.
Author and all-around good cowpoke
posted 14 years ago
I had never run across that before, now it has me wondering how you have a servlet that is "not deployed as part of a Web application."
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad: