cancel
Showing results for 
Search instead for 
Did you mean: 

InitialContext in a cluster

former_member188498
Active Participant
0 Kudos

Hi,

I have an application which gets a list of user sessions from servers in production cluster.

There are 5 servers in the cluster.

Then problem is that I'm always getting a list of user sessions only from the current server on which the user is logged on, and not

from all servers. Maybe it has something to do with initialcontext parameters.

Here is the code to connect to the specific server in the cluster:


Hashtable env = new Hashtable();
env.put("force_remote", "true");
env.put(Context.PROVIDER_URL,  "191.138.54.10:50704#78139452); //address is different of course

InitialContext context = new InitialContext(env);
	
Object obj = context.lookup( "remotesecurity" );
RemoteSecurity remoteSecurity = (RemoteSecurity) PortableRemoteObject.narrow(obj, RemoteSecurity.class);
RemoteSecuritySessions sessions = remoteSecurity.getSecuritySessions();
SecuritySession securitySession[] = sessions.listSecuritySessions();
....

PS.

When I use this code from another server (test server) and connect to the production cluster, I'm getting the full list of user sessions from all nodes in the production cluster.

So it working everywhere except when it is deployed to production server and run from there.

Maybe somebody has idea how to handle this or which parameters should I put into the InitialContext?

Regards,

Ladislav

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Ladislav,

Unfortunately, that is not possible to be done when you are already running on the server. The "#serverID" directive can be specified only for external clients. You cannot jump from one server node to another in the <b>same instance</b>, only to a different instance in the same or different cluster.

For more info please have a look at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/08/8f633e0084e946e10000000a114084/frameset.htm">this</a> document.

Best regards,

Vladimir

former_member188498
Active Participant
0 Kudos

Ok, thanks. So the conclusion is that it is not possible to be done on the same cluster on which the application runs. Right? Too bad.

Regards

Ladislav

Vlado
Advisor
Advisor
0 Kudos

Actually, it is not possible to be done on the same <b>instance</b> on which the application runs. You can jump to any server node on <b>another instance</b> in the <b>same cluster</b>.

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you tell me in which JAR file the RemoteSecurity and RemoteSecuritySessions classes reside?

I have searched my portal server directories but cannot find which JAR files I need to include to get the code running in NetWeaver Developer Studio.

Thanks,

Tom

former_member188498
Active Participant
0 Kudos

Hi Tom,

I have it from security.jar file, but I can't remember from which location I did

take it from.

I can send this jar to your email if you want.

Regards

Ladislav

Vlado
Advisor
Advisor
0 Kudos

Hi Ladislav, Tom,

This is the jar of the Security service (physically located at /usr/sap/<SID>/<instance>/j2ee/cluster/server<N>/bin/services/security). At runtime you should reference this service in your J2EE app's application-j2ee-engine.xml (<a href="http://help.sap.com/saphelp_nw04/helpdata/en/53/69662514eb6e46b1eb6e77ae5cf10b/frameset.htm">more info</a>).

To get the code built and running in the NWDS (i.e. a standalone app) you need to add the following jar in the build path of your Java project: <NWDS_root_folder>eclipsepluginscom.sap.tc.apcompSAP-JEEDCssap.comcom.sap.engine.client.lib\_compgendefaultpublicdefaultlibjavasapj2eeclient.jar (<a href="http://help.sap.com/saphelp_nw04/helpdata/en/88/3c8342fa4b5551e10000000a1550b0/frameset.htm">more info</a>).

However, please note that these are internal J2EE Engine APIs and are not released for custom applications development. They might be changed at any time in a future SPS/release, so it's at your own risk if you decide to use them. All publicly available APIs can be found <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/javadocs">here</a>.

Best regards,

Vladimir

Former Member
0 Kudos

Hi,

I read with attention this topic.

I wonderred what was the best solution to get the users logged into the portal??

I made a Web dynpro, with the code found in the wiki part on this site. But it doesn't show the user if he logged in but didn't made any action into the portal.

I can not understand this, he must be in the logged in users if he just logged in???

If anyone could help me.

Thanks in advance.