aspose file tools*
The moose likes Servlets and the fly likes Servlet context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet context" Watch "Servlet context" New topic
Author

Servlet context

geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
Assuming that the servlet container is distributed across multiple JVMs, which of the following statements are correct?



Options

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
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
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.


How is this possible??
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Can you (or anyone) explain me, what is default servlet context?

... then I will be able to answer your question.

Thanks.
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
wish i knew it...
thats the first time i read it..
was browsing through some dummy questions.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
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.

Bill


Java Resources at www.wbrogden.com
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
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.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
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."

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet context
 
Similar Threads
ServletContext in Distributed Env.
mock question regarding distributed application across multiple JVMs
Default servlet context
distributed across multiple JVM
Defaul ServletContext ...??? Question