Using Websphere(WAS) API in Java class to get WAS server details

Using Websphere(WAS) API in Java class to get WAS server details

Here is a simple Java class which WAS(Websphere) API's to get WAS(Websphere) server details like cellname and nodename etc.

To make the below java class work we need to Jar files to be added to build path in our eclipse . These jar files will be available in WAS 851 installaiton.

C:\Program Files\IBM\WebSphere\AppServer\runtimes\

C:\Program Files\IBM\WebSphere\AppServer\plugins\

Java class: 


import java.util.Iterator;

import java.util.Set;




public class AdminClientTest {

public static void main(String[] args) {

AdminClient ac = null;

java.util.Properties props = new java.util.Properties();

props.put(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);

props.put(AdminClient.CONNECTOR_HOST, "localhost");

//16313 : bootstrap port , check corresposding port from ur Aboutheprofile.txt

props.put(AdminClient.CONNECTOR_PORT, "16313");

props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");

props.setProperty(AdminClient.USERNAME, "UR_PROFILE_USERNAME");

props.setProperty(AdminClient.PASSWORD, "UR_PROFILE_PASSWORD");

// Trust store properties

props.setProperty("","C:\\Program Files\\IBM\\JazzSM\\profile\\etc\\DummyClientTrustFile.jks");

//WebAS : this is a default password to be used . Don't change this


// Key store props

props.setProperty("", "C:\\Program Files\\IBM\\JazzSM\\profile\\etc\\DummyClientKeyFile.jks");

//WebAS : this is a default password to be used . Don't change this

props.setProperty("", "WebAS");

try {

ac = AdminClientFactory.createAdminClient(props);

System.out.println ("connected"); on = new ObjectName("WebSphere:type=Server,*");

Set servers = ac.queryNames(on, null);

Iterator itr = servers.iterator();





catch(Exception ex) {

System.out.println("getAdminClient: exception");





Sample Output : 





Reference : WAS 6.1 JMX AdminClient. (Websphere forum at JavaRanch)

0 comments to "Using Websphere(WAS) API in Java class to get WAS server details"

Post a Comment

Whoever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs, u can at least use Name/URL option which doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")

Popular Posts

Enter your email address:

Buffs ...


Powered by WidgetsForFree