Q&A
-
How would I go about debugging my servlet to identify runtime problems?
-
Since servlets are server-side Web applications, there is no straightforward way to debug servlets unless the IDE (integrated development environment) that you use has the necessary features to support debugging applications deployed on the WebLogic Server. The simplest way to debug a servlet is to print the trace of the code on the stdout stream and view the log file to identify the errors. You will be learning different techniques of debugging servlets on Day 17, "Debugging Applications," when you look at all aspects of debugging applications in the WebLogic Server environment.
-
I need to deploy the servlet on two WebLogic Servers in a cluster of two machines. The same servlet will be placed on both machines. Will the user session appear to be the same irrespective of the machine from which the request is processed?
-
When a servlet is deployed in a WebLogic Server cluster, the servlet's session is replicated on all the machines in the cluster by the primary server in the cluster. This ensures that all the machines in the cluster have the same session, and irrespective of the machine in the cluster servicing the client request, the client browser will get the same session state. To use servlets in a cluster, the WebLogic Server must have the HttpClusterServlet software.
The requests in the cluster are forwarded in a round-robin sequence to all the WebLogic Servers in the cluster by the primary WebLogic Server. To enable the HttpSession to be replicated in the cluster, you need to modify the WebLogic Serverspecific deployment descriptor file weblogic.xml and add the following tag:
<session-descriptor> <session-param> <param-name>PersistentStoreType</param-name> <param-value>replicated</param-value> </session-param> </session-descriptor>