| Author |
How can i get cluster's server message!
|
|
|
| i use websphere 5.1 ND. i build 3 server for cluster ,and use http server to connect websphere. the question is when i interveiw the jsp page.
i don't konow which server processed my request. so i want to get server message in programing for identifing the server. who can help me! thank you so much!
| |
| Brian S Paskin 2007-07-22, 7:19 am |
| Hi, In your JSP add the following lines:
<%
java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
out.print(addr.getHostName());
%>
Brian
| |
|
| May be i didn't articulated in the former. the 3 server all build in a physical computer.your method is get the computer name.but the 3 server are in identical computer.i also don't know which server is process!
| |
| Brian S Paskin 2007-07-24, 1:26 pm |
| Hi, I guess you want the server name to appear. Most people have some kind of initial parameter that is read in to achieve this. If this is just for debugging purposes, you can printout the port number by looking up the request.getServerPort().
I will look if there is another way.
Brian
| |
|
| IIRC, the Servlet Context has an entry with the Application Server name.
| |
| Brian S Paskin 2007-07-24, 1:26 pm |
| Hi, The ServletContext.getServerInfo() returns the name and version of the container, not the actual sever name. In the case of WebSphere v6 it should be something like "WebSphere Application Server/6.0".
Brian
| |
| Ken Hygh 2007-07-24, 7:21 pm |
| linh@telthink.com wrote:
> May be i didn't articulated in the former. the 3 server all build in a physical computer.your method is get the computer name.but the 3 server are in identical computer.i also don't know which server is process!
try {
Set s =
AdminServiceFactory.getMBeanFactory().getMBeanServer().queryMBeans(new
ObjectName("WebSphere:type=JVM,*"),null);
ObjectInstance instance = (ObjectInstance)s.iterator().next();
ObjectName oName = instance.getObjectName();
System.out.println(oName.getKeyProperty("process"));
} catch (MalformedObjectNameException e) {
e.printStackTrace();
}
Ken
| |
| Brian S Paskin 2007-07-24, 7:21 pm |
| Fantastic Ken!
Brian
| |
| Ken Hygh 2007-07-25, 1:23 am |
| Brian S Paskin wrote:
> Fantastic Ken!
>
> Brian
JMX has gotta be good for something! :-)
| |
|
| Tank you Ken!.it all right!!! >_<
|
|
|
|