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\com.ibm.ws.admin.client_8.5.0.jar
C:\Program Files\IBM\WebSphere\AppServer\plugins\com.ibm.ws.security.crypto.jar
Java class:
package com.ibm.was.api.test;
import java.util.Iterator;
import java.util.Set;
import javax.management.ObjectName;
import com.ibm.websphere.management.AdminClient;
import com.ibm.websphere.management.AdminClientFactory;
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("javax.net.ssl.trustStore","C:\\Program Files\\IBM\\JazzSM\\profile\\etc\\DummyClientTrustFile.jks");
//WebAS : this is a default password to be used . Don't change this
props.setProperty("javax.net.ssl.trustStorePassword","WebAS");
// Key store props
props.setProperty("javax.net.ssl.keyStore", "C:\\Program Files\\IBM\\JazzSM\\profile\\etc\\DummyClientKeyFile.jks");
//WebAS : this is a default password to be used . Don't change this
props.setProperty("javax.net.ssl.keyStorePassword", "WebAS");
try {
ac = AdminClientFactory.createAdminClient(props);
System.out.println ("connected");
javax.management.ObjectName on = new ObjectName("WebSphere:type=Server,*");
Set servers = ac.queryNames(on, null);
Iterator itr = servers.iterator();
while(itr.hasNext()){
System.out.println(itr.next().toString());
}
}
catch(Exception ex) {
System.out.println("getAdminClient: exception");
ex.printStackTrace();
}
}
}
Sample Output :
connected
WebSphere:name=server1,process=server1,platform=proxy,node=JazzSMNode01,j2eeType=J2EEServer,version=8.5.0.1,type=Server,mbeanIdentifier=cells/JazzSMNode01Cell/nodes/JazzSMNode01/servers/server1/server.xml#Server_1183122130078,cell=JazzSMNode01Cell,spec=1.0,processType=UnManagedProcess
Reference : WAS 6.1 JMX AdminClient. (Websphere forum at JavaRanch)
Reactions: |
0 comments to "Using Websphere(WAS) API in Java class to get WAS server details"
Tags
Powered by WidgetsForFree
My Blog List
Popular posts
- Airtel and vodafone GPRS settings for pocket PC phones
- Andhra 2 America
- Ayyappa Deeksha required things
- Blogs I watch !
- Captions for your bike
- DB2 FAQs
- Deepavali Vs The Goddes of sleep
- ETV - Dhee D2 D3
- Evolution of smoking in India Women
- How to make credit card payments?
- Java-J2EE interview preparation
- My SQL FAQs
- My Travelogues
- Old is blod - New is italic
- Online pay methids for credit cards
- Oracle FAQs
- Pilgrimages
- Smoking in Indian Women
- Technology Vs Humans
- Twitter feeds for all Telugu stars on single page.
- Unix FAQs
- Unix best practices
- init 0, init 1, init 2 ..
- mCheck Application jar or jad download

Post a Comment
Who ever 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 don’t even require any sign-in, good thing is that it can accept your lovely nick name also and URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")
వీలయితే నాల్గు పోస్టులు ...కుదురితే ఒక కామెంటూ ...