Powered by Syntax Highlighter scripts!

Getting Server name in a cluster - Websphere Solution

When we work on a cluster environment of 2 or 3 nodes, Debugging an issue will become nightmare if we have to trace the recent page hit manually to a particular server name for looking logs.

Best way to attack this issue is by printing the server name as META data in the page HTML or to print the required information in HTML comments of the page.

You can use the code snippet below in a JSP page to print the server node name in a cluster.
<!-- Server Display Name: <%=ServerName.getDisplayName()%> -->
<!-- Server Full Name: <%=ServerName.getFullName()%> -->

Do not forget to add import statement as "com.ibm.websphere.runtime.ServerName".


No comments: