WebSphere Application Server - How can i get cluster's server message!

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > July 2007 > How can i get cluster's server message!





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How can i get cluster's server message!

2007-07-22, 1:20 am

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

2007-07-24, 7:21 am

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
Ben_

2007-07-24, 1:26 pm

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! :-)

2007-07-25, 7:22 am

Tank you Ken!.it all right!!! >_<
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com