Thursday September 08, 2005 | ${log.root}/lowem.log Inflation, Investing and Everything |
|
WebLogic Domain/Cluster runtime information mttech.com, samspublishing.com : Needed a "proper" way to get the ListenAddress and ListenPort settings that were defined in the WebLogic server's config.xml file (besides opening and parsing the darn file directly, of course, lol). The links above include code for a servlet called InfoCluster which can be adapted to do just that. This stemmed from a requirement to get the "localhost" address for a multi-homed server. If you just do an InetAddress.getLocalHost(), it appears that, for a multi-homed machine (one with more than one local IP address, due to multiple network cards or virtual adaptors), you will get just one of the available IP addresses, and the order of obtaining that address is implementation-specific to the JDK you're using (!) On the other hand, obtaining the "ListenAddress" this way now makes the code WebLogic-specific (you know - gain some, lose some). Another way might be to use your system's configuration mechanism (whatever it is) and just do a config.getString() (for example - whatever the API is). And *then* your configuration mechanism will have to take care of deployment onto different machines - which, hopefully, at this point, it is not *your* problem :) (2005-09-08 13:11:00 SGT)
[Java]
Permalink
Comments [2]
Post a Comment:
Comments are closed for this entry.
Most popular blog postings on lowem.log : 1. Singapore SIBOR interest rates fall to 1.5%, lowest since Dec 2004 Featured articles on lowem.log : 1. ABC Guide to Beating Inflation in Singapore and Elsewhere |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Context ctx = new InitialContext();
MBeanHome home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
Set clusters = home.getMBeansByType("Cluster");
for (Iterator iterator = clusters.iterator(); iterator.hasNext();)
{
ClusterMBean cluster = (ClusterMBean) iterator.next();
ServerMBean[] servers = cluster.getServers();
for (int i = 0; i < servers.length; i++)
{
ServerMBean server = servers[i];
String address = server.getListenAddress();
int port = server.getListenPort();
String name = server.getName();
}
}
?
Posted by Dmitri Colebatch on September 08, 2005 at 03:41 PM SGT #
Posted by Vinny Carpenter on September 09, 2005 at 03:57 AM SGT #