on 09-17-2009 10:46 AM
Hi experts,
I want to display some metainformation of my Softwarecomponent. Is thera an api to get this information?
I need the information which are displayed on the site http://<server>:<j2ee-port>/sap/monitoring/ComponentInfo in the first section: Software Components".
Thanks,
Thomas
Edited by: Thomas Morandell on Sep 17, 2009 3:28 PM
Hi,
If you are on CE, then try this:
MBeanServerConnection mBeanConn = getMBeanServer();
ObjectName j2eeCluster = getClusterOName();
Set relatedNames = RelationHelper
.getRelatedMBeans
(mBeanConn,
j2eeCluster,
"com.sap.engine.admin.model.itsam.rel.SAP_ITSAMJ2eeClusterSoftwareComponent",
"SAP_ITSAMJ2eeClusterSoftwareComponentGroupComponent",
"SAP_ITSAMJ2eeClusterSoftwareComponentPartComponent"
);
if(relatedNames != null) {
for (Iterator iterator = relatedNames.iterator(); iterator.hasNext();) {
ObjectName object = (ObjectName) iterator.next();
String scName = mBeanConn.getAttribute(object, "Name")).toString();
String scVendor = mBeanConn.getAttribute(object, "Vendor")).toString();
String scVersion = mBeanConn.getAttribute(object, "Version")).toString();
}
}
You will need a DC dependency on "tc/jmx" available under "SERVERCORE" s/w component.
Here's the rest of the code:
private MBeanServerConnection getMBeanServer() {
Context ctx = new InitialContext();
return (MBeanServerConnection)ctx.lookup("jmx");
}
//ObjectName for the J2EE cluster
private ObjectName getClusterOName() {
final MBeanServerConnection mbs = getMBeanServer();
if(mbs != null) {
final ObjectName pattern = new ObjectName(":type=SAP_ITSAMJ2eeCluster,*");
Set set = mbs.queryNames(pattern, null);
if(set.size() > 0)
return ((ObjectName)set.iterator().next());
return null;
}
}
I have left out the exception handling for brevity & you'd do well do run this code with admin rights.
Regards,
Satyajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much! It worked!
I have one more question: Do you know how to provide the required permission?
The exceptions message, which is thrown, if I don't use the admin user, is:
"Caller Sec_Initiator not authorized, required permission missing (javax.management.MBeanPermission -#-[-] queryNames) "
How can I add this single Permission to my user?
We use in our project a custom DC of the type UME Persmission, where we define custom application persmissions. It should be possible, to enrich the file action.xml with the required persmission, shouldn't it? How?
An other way to solve the problem, may be to assign the required action to my users role (we are using the enterprise portal).
Regards,
Thomas
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.