*
The moose likes Websphere and the fly likes Getting Was node's name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Getting Was node Watch "Getting Was node New topic
Author

Getting Was node's name?

mik laan
Greenhorn

Joined: Sep 04, 2002
Posts: 29
Hello,
I have a clustered environment with multiple Was instances and clones.
Are there any Was related java class, JNDI entry or system property
(System.getProperty()) that could be used in my java applicalition to tell in which node my application is running?
Thanks,
Raj Varanasi
Greenhorn

Joined: Nov 20, 2001
Posts: 11
Hi,
Usually hostname will be node name for websphere in a clustered environment.You can use the following code(jsp code) to get the hostname in ur java application.This is for solaris environment.

<%@ page import="java.io.*"%>
<%
String command = "hostname";
Process p = Runtime.getRuntime().exec(command);
String s =null;
DataInputStream in = new DataInputStream(p.getInputStream());
while ((s = in.readLine()) != null) {
out.println("Hostname is: " + s);
}
%>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting Was node's name?
 
Similar Threads
How to invoke a java class which is not an applet from the html page?
Informal poll: What are the most popular 1st languages?
Dial Up Software Using Java
newbie needs tutorials on java
Difference between Event propagation & Event delegation