cancel
Showing results for 
Search instead for 
Did you mean: 

How to read SC metainformation

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Add the UME Action "JmxManageAll" to the role that your user has.

Regards,

Satyajit

Former Member
0 Kudos

Thank you!

Answers (0)