WebLogic Session Replication Issues



Hi,
USEFUL Debuging techinques:Most of the Time we find Session Replication related Issues while using the Clustering Features of Weblogic.
Enable the Debug Flags to track Session Replication Failures:
You could enable the flags DebugCluster, DebugClusterAnnouncements, DebugFailOver, DebugReplication, DebugReplicationDetails.
To Enable: You can use the weblogic.Admin command line utility to dynamically turn the debug options on and off.
For example, to turn on DebugCluster on all administration instances of ServerDebug Mbean (i.e., Admin Server or al Managed Server):
java weblogic.Admin -url t3://localhost:7001 -username system -password weblogic SET -type ServerDebug -property DebugCluster true
***Symptoms***:
1). After Logging into the Application which is deployed on WebLogic Cluster… Users suddenly finds themself to be redirected to Login page again even if they haven’t clicked on Logout Button.
2). In these cases There may be many reasons behind this…There may be Multicast Issues(Network Issues) in the Network where the WebLogic Clusters are running. Means Managed Servers which is part of the Cluster are not able to send Heartbeat messages to eachother. In these kind of scenario first of all we need to Apply the Multicast Test Utility provided as part of WebLogic. For more Informations you can refer to “http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs81/admin_ref/utils25.html” Multicast Util Informations.
3). Getting java.io.NotSerializableException” in Server Logs
4). May be the Default Session Cookie Name is different in “weblogic.xml” and It’s not same as the WebProxy Default Cookie Name.
PARAMETERDEFAULTDESCRIPTIONAPPLICABLE TO
CookieNameJSESSIONIDIf you change the name of the WebLogic Server session cookie in the WebLogic Server Web application, you need to change the CookieName parameter in the plug-in to the same value. The name of the WebLogic session cookie is set in the WebLogic-specific deployment descriptor, in theelement.Note: TheCookieName parameter has been renamed as WLCookieName. A warning message is issued if you continue to use the old parameter name.NSAPI, ISAPI, and Apache plug-in, HttpClusterServlet, and HttpProxyServlet
In most of the Cases i have observed that Users get Logged off from our applications which is targeted to a Cluster .is because of the Application. If an application is storing some NonSerializable Data Objects inside the HttpSession as an attribute then the WebLogic Cluster is not able to replicate these Non-Serializable data to the replicated HttpSession on another Secondary Managed Servers. For a Large scale applications it is not an easy task for developers to check the complete code again…sothat they can identify that all the HttpSession Attributes are implementing the java.io.Serializable interface or not.
Here is a simple JSP page which is able to display all the HttpSession attributes in a tabular format along with the report that Which Session Attribute is Not Serializable. We need to Just bundle this JSP inside our existing application which is causing the issue. Then we need to login to our application we need to access this additional page “SerializationTest.jsp” sothat if any HttpSession attribute is already stored inside the HttpSession then it can display it’s complete information.
***NOTE:
Here i am providing a complete TestCase for this JSP…to demonstrate How actually it works..But you need to add only the “SerializationTest.jsp” page inside your application which is causing the issue
SerializationTest.jsp
—————————-
Session Attribute NameSession Attribute ValueSTATUS

—————————-
*********Complete TestCase Below:**********
Just to know how it actually works Just develop a Sample Web Application with the following details
Step1). Develop a classes “Emp.java” here Emp class should NOT implement the “java.io.Serializable” interface.
package pack;
public class Emp
{
String name=”Default Name”;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name=name;
}
}
Step2). Develop a classes “Salesman.java” here Emp class should implement the “java.io.Serializable” interface.
package pack;
public class Salesman implements java.io.Serializable
{
String name=”Default Salesman Name”;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name=name;
}
}
Step3). Compile the above two classes and place them inside your WebApplications “WEB-INF/classes” directory
D:\DELETE\SessionTest\WEB-INF\classes> javac -d . Emp.java
D:\DELETE\SessionTest\WEB-INF\classes> javac -d . Salesman.java
Step4). Now provide the “index.jsp” Page as below:
index.jsp
————————

Session Object Created with the Following Attributes:


session.setAttribute(“EmpAttribute”,new pack.Emp());


session.setAttribute(“SalesmanAttribute”,new pack.Salesman());

————————
Step5). Now provide the Sample “web.xml“ we don’t need to enter much information in this file …as it is just a TestCase.
http://java.sun.com/xml/ns/j2ee“>
Step6). Now If you want to enable Session Replication for your WebApplication then provide the “weblogic.xml” file like below…(In our TestCase at present this is not required…as we are just going to test The HttpSession attribute is Serializable or Not. it can be tested in a NonClustered Managed Server as well)

http://www.bea.com/ns/weblogic/90“>

replicated


Step7). Now Deploy your Application in WebLogic Server…
Step 8). Access the “index.jsp” page of your application then you will find the following output:
Thanks

0 Response to "WebLogic Session Replication Issues"

Post a Comment

Powered by Blogger