cancel
Showing results for 
Search instead for 
Did you mean: 

How to Retrieve Instance IDs programatically

Former Member
0 Kudos

I would like to retrieve the instance ID programmatically, for server and dispatcher. For example, for the dispatcher the ID is 578900 and for the server the ID is 578600.

Could any one give me a favor to show how to do with it?

(I know that I can read it from systeminfo, but I really would like to get it programatically).

Best Regards

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Are trying to do this from the java side or the ABAP side?

REgards,

Rich Heilman

Answers (4)

Answers (4)

Former Member
0 Kudos

Yeah, it is not really working.

One way might be using MBean for retrieving monitoring data since the cluster informations are monitored in the visual admin. However, the tutorial in

http://help.sap.com/saphelp_nw04/helpdata/en/25/19e7752be1c8459258a072d87e3a34/frameset.htm

and

http://help.sap.com/saphelp_nw04/helpdata/en/25/19e7752be1c8459258a072d87e3a34/frameset.htm

are not followable.

I could not find the javax.management.MBeanServer and com.sap.jmx.remote.JmxConnectionFactory.

Anyway, I think it is an inderect and complex way to retrieve a set of simple information

Former Member
0 Kudos

1. You can find the com_sap_pj_jmx.jar , jmx_notification.jar and jmx.jar under the folders of serverX/bin. you use it compile your java source code.

2. you can open the application-j2ee-engine.xml , add the references to jmx, tc/jmx,com.sap.tc.logging and naming-api.

3. I think you can use the com.sap.jmx.remote.JmxConnectionFactory to get the instance of MBeanServerConnection to query instance id. for example.

MBeanServerConnection mbsc = JmxConnectionFactory.getMBeanServerConnection(JmxConnectionFactory.PROTOCOL_ENGINE_P4, p);

System.out.println(mbsc.getDefaultDomain());

ObjectName serverObjName = null;

try {

serverObjName = ObjectName.getInstance("com.sap.default:*,j2eeType=SAP_J2EEClusterNode,SAP_J2EECluster=J2E");

} catch (Exception e1) {

e1.printStackTrace();

}

Former Member
0 Kudos

Thank you again heilman.

I will try it tomorrow morning and return the result

to you again:-)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are not using WD, I don't think that it will work for you, but maybe it might spark an idea.

Regards,

Rich Heilman

Former Member
0 Kudos

No, I am writing a J2EE application.

Message was edited by: ning he

Former Member
0 Kudos

Thank you Heilman

From java side.

And the Web AS is also Java instance.

I would like to retrieve the instance information remotely. Is it possible?

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Are you using a WebDynpro application?

Not sure if this will help you or not.

http://help.sap.com/saphelp_nw04/helpdata/en/25/19e7752be1c8459258a072d87e3a34/frameset.htm

Regards,

Rich Heilman