Hi there,
I'm trying to get an external JMX client to connect to a SAP Web AS ABAP+Java 640 (Unicode, SP 9).
My first problem was that I couldn't find the file
client.jar as written in "Compile and Run your Client" of
the JMX Service Interface documentation. I could solve the
"class not found" problems by using sapj2eeclient.jar, so
I think the file has just been renamed.
I then tried to run the following code, which has been
taken more or less from the "Connecting to an MBeanServer"
example.
import java.util.Properties;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.naming.Context;
import com.sap.jmx.ObjectNameFactory;
import com.sap.jmx.remote.JmxConnectionFactory;
public class Client {
public Client(
) {
}
private void run(
) {
try {
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
props.setProperty(Context.SECURITY_PRINCIPAL, "J2EE_ADMIN");
props.setProperty(Context.SECURITY_CREDENTIALS, "password");
props.setProperty(Context.PROVIDER_URL, "my-server:50004");
MBeanServerConnection mbsc = null;
mbsc = JmxConnectionFactory.getMBeanServerConnection(
JmxConnectionFactory.PROTOCOL_ENGINE_P4, props);
String path = "Root/Services/Memory/AllocatedMemory";
ObjectName name = null;
name = ObjectNameFactory.getNameForMonitorPerNode(
ObjectName.quote(path), null, null);
System.out.println("ObjectName: " + name.getCanonicalName());
Integer value = (Integer)mbsc.invoke(name, "getValue", null, null);
System.out.println("Value: " + value);
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public static void main(
String[] args
) {
new Client().run();
}
}
Unfortunately, I get the following error:
com.sap.engine.services.jmx.exception.JmxConnectorException: Unable to connect to connector server.
at com.sap.engine.services.jmx.connector.p4.P4ConnectorClient.<init>(P4ConnectorClient.java:96)
at com.sap.engine.services.jmx.connector.p4.ConnectorFactory.getJmxConnector(ConnectorFactory.java:31)
at com.sap.jmx.remote.JmxConnectionFactory.getConnector(JmxConnectionFactory.java:191)
at com.sap.jmx.remote.JmxConnectionFactory.getMBeanServerConnection(JmxConnectionFactory.java:92)
at Client.run(Client.java:29)
at Client.main(Client.java:51)
Caused by: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.]
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:538)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at com.sap.engine.services.jmx.connector.p4.P4ConnectorClient.<init>(P4ConnectorClient.java:69)
... 5 more
Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.
at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:98)
at com.sap.engine.services.jndi.implclient.LoginHelper.clientSideLogin(LoginHelper.java:78)
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:402)
... 10 more
Caused by: java.lang.NullPointerException
at com.sap.engine.services.security.remote.RemoteSecurity_Stub.getRemoteLoginContext(RemoteSecurity_Stub.java:678)
at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:93)
... 12 more
Am I doing something wrong? Any help or hint would be
greatly appreciated.
Regards, Bernd
Request clarification before answering.
Hi Vladimir
thanks for your reply.
The real server name is called sap-640-sapdb and I called with the correct server name
(I have just changed password and server in the example code).
It was up and running, of course.
I could make it work, but only if my Client class is running localy on sap-640-sapdb.
I could not make it work to run remotely from my PC. I get the exception:
Caused by: java.rmi.ServerException: The server, that the client is connected with, isn't working.
The object is not redirectable!
Meanwhile I have installed a complete SAP NetWeaver Dev. Environment on my PC.
I get exactly the same error message, when I want to connect with Visual Administrator installed with the J2EE instance on my Windows PC to the J2EE instance running on the Linux box sap-640-sapdb.
Isn't it possible to use P4 protocol remotely?
Thanks, Bernd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bernd
I am successful in using a JMX client remotely for logging the HTTP session data from SAP WebAS 710 release. I have done this in the context of monitoring the number of HTTP sessions to correlate with Memory utilized on WebAS.
The piece of code that I wrote is more or less similar to what you posted in the thread here.
If you would like to have a look at it, just let me know so that I can mail it to your id.
Thanks and Regards
Madhu
Hi Madhu:
I find the same problem. Can you mail your code to me?
My email is : [email protected]
Thank you very much!
Best regards.
Garf
Hi Madhu, Garf
I have same problem, can you mail it also to me ?
My email is : [email protected]
Thanks
hans
Hi Madhu,
I am using SAP WAS 6.4. I am having problems in connecting from a remote JMX client to obtain the metrics. Can you please email me your code?
My email-id is [email protected].
Thanks and Regards,
Sridhar Raj
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.