on 05-23-2006 11:33 AM
Anyone knows how to get Netweaver WAS Installation number and system id using java? I need these numbers to generate a unique key.
Any help would be much appreciated. Thanks.
Hi Julius,
There's the most trivial and easiest way to obtain the SID:
String systemID = System.getProperty("SAPSYSTEMNAME");
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Julius,
Try this
import javax.naming.InitialContext;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import com.sap.jmx.ObjectNameFactory;
.....
InitialContext ctx = new InitialContext();
MBeanServerConnection mbsc = (MBeanServerConnection)ctx.lookup("jmx");
ObjectName LICENSING_SERVICE_ON = LICENSING_SERVICE_ON = ObjectNameFactory.getNameForServerChildPerNode("SAP_J2EEServiceRuntimePerNode", "licensing", null, null);
String number = (String)mbsc.getAttribute(LICENSING_SERVICE_ON, "InstNo");
.....
Don`t forget to add reference to jmx service.
Best regards, Maksim Rashchynski.
Hi Maksim,
Thanks again for your prompt reply. From the SDN library, to add the reference, i believe i need to alter provider.xml located in the application server's folder, but that has defeated the purpose of getting the NW installation number, in my case.
Sorry if i didnt explain the purpose of getting the installation number in the first place. The purpose is to generate a unique license key for my j2ee product for a single NW WAS instance, based on system id, installation number, etc. Therefore, altering provider.xml will not serve the purpose as i couldnt expect the user to do that.
Do you by any chance came across of other way to get the installation number? Or know of any system info. that can be uniquely identified a NW WAS instance?
Hi Julius,
1) Add mentioned above jar file to class path of your application
2) In enterprise application project folder META-INF find application-j2ee-engine.xml and add
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="service">jmx</reference-target>
</reference>
3) Use mentioned above code to get installation number.
Best regards, Maksim Rashchynski.
Hi Maksim,
Thanks again for your reply.
I'm getting this exception after add the second reference:
com.sap.engine.services.jmx.exception.JmxSecurityException: Caller J2EE_GUEST not authorized, only role administrators is allowed to access JMX , com.sap.engine.services.jmx.exception.JmxSecurityException: Caller J2EE_GUEST not authorized, only role administrators is allowed to access JMX#
Anything else to be configured?
From SAP Note Number 948970:
5. If the Exception is similar to "Caller MY_USER not authorized, only role administrators..." then make sure the user MY_USER has the required administrative privileges for the requested operation (configured using Visual Administrator).
In my case, <b>how do i change the default user J2EE_GUEST to J2EE_ADMIN</b>? I guess J2EE_ADMIN should have enough privilege to do JMX operation.
Thanks.
Hi Julius,
If you are running EJB, it is actually piece of cake. Check http://help.sap.com/saphelp_nw04/helpdata/en/60/bbfc3eea4d2e5ae10000000a114084/frameset.htm
Instead of "carCustomer" and "customer" specify "administrators".
Best regards, Maksim Rashchynski.
Hi Maksim,
I'm trying to do the same thing in webdynpro, but every time I get the 'ClassCastException'.
InitialContext initialCtx = new InitialContext();
MBeanServer mbs = (MBeanServer)initialCtx.lookup("jmx");
<property name="ServicesReference" value="sap.com/jmx"/>
<property name="LibrariesReference" value="sap.com/tc~jmx"/>
the JNDI look up has this entry -
+ jmx
+ [Class Name] : com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain
+ [Object Value] : NON Serializable Object
J2EE Engine is 6.40.
could you please tell me what I'm missing.
Thanks in advance,
Rajiv.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.