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)
0 comments to "Using Websphere(WAS) API in Java class to get WAS server details"
Popular Posts
-
The best solution to know about these init levels is to understand the " man init " command output on Unix. There are basically 8...
-
How to Unlock BSNL 3G data card to use it with Airtel and Vodafone Model no : LW272 ? How to unlock BSNL 3G data card( Model no : LW272 )us...
-
How to transfer bike registration from one State to other (Karnataka to Andhra)?? Most of us having two wheelers purchased and registered in...
-
ఓం శ్రీ స్వామియే శరణం ఆయ్యప్ప!! Related posts : Trip to Sabarimala - Part 1 Trip to Sabarimala - Part 2 Ayappa Deeksha required things...
-
Following are some of interesting blogs I found till now ...please comment to add your blog here. Blogs in English : http://nitawriter.word...
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?
- init 0, init 1, init 2 ..
- Java-J2EE interview preparation
- mCheck Application jar or jad download
- 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 best practices
- Unix FAQs
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")