cancel
Showing results for 
Search instead for 
Did you mean: 

context lookup on specific server

Former Member
0 Kudos

Hello!

On the portal, I'm interested to find out, who is loged in at the moment. For this I use the following.

...

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL, "myserver:50004");

env.put("force_remote", "true");

env.put(InitialContext.SECURITY_PRINCIPAL, "user");

env.put(InitialContext.SECURITY_CREDENTIALS, "pw");

ctx = new InitialContext(env);

com.sap.engine.services.security.remote.RemoteSecurity security = (RemoteSecurity_Stub) ctx.lookup("remotesecurity");

RemoteSecuritySessions rss = security.getSecuritySessions();

...

This works to geht the sessions from the instances server and from the server of an other instance.

Now my problem. I have 2 servers per instance. This code connects only to one server of any instance. Is there any parameter I can set for the context to get on server0 or on server1? Or do I have no chance because this will always connect to the java dispatcher an therefore I won't be able to get the server I want? Perhaps anybody has a helpful idea?!

Best regards an thanks for help,

Christian

Accepted Solutions (1)

Accepted Solutions (1)

christiansche
Active Participant
0 Kudos

Hi,

Well, I call once

env.put(Context.PROVIDER_URL, "myserver:50004");

and after this

env.put(Context.PROVIDER_URL, "myserver:50104");

but I get only the sessions from one server of each instance. I can change the Instance by using the instances port, but how can I change on one instance from one serverprocess to the other?

Best Regards,

Christian

former_member188498
Active Participant
0 Kudos

Hi,

have you found a solution?

You just need to

append #clusterID, where clusterID is id of the server node in a cluster.

For example:

env.put(Context.PROVIDER_URL, "myserver:50004#13557250");

Regards

Ladislav

Answers (1)

Answers (1)

christiansche
Active Participant
0 Kudos

Hello!

Is nobody out there with an idea aout this?

Best regards an thanks for help,

Christian

Former Member
0 Kudos

Hi,

I think you need to change the port of Context Factory source from another server(server instance 2)

Kiran