Skip to Content
avatar image
Former Member

Retrieve user sessions from all nodes / force_remote

Hello,

I am trying to retrieve all user sessions from all nodes in a J2EE portal environment. The code below works great. However, it only returns the users from the node I am currently attached to.

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); 
env.put(Context.PROVIDER_URL, serverIP + ":" + serverPort + "#" + serverId);
env.put("force_remote", "true");

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();

So I included this statement to attach to remote servers per [SAP instructions|http://help.sap.com/saphelp_nw04/helpdata/en/8d/41ee1b22797c4b9d9b7ad67aa7333f/content.htm]. But that generates the error you see below.

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

#1.#C6CD2000E002007600000BC8001ED034000477BB4B57FFF1#1257546213490#com.sap.engine.core.cluster.impl6.JoinPortListener#
#com.sap.engine.core.cluster.impl6.JoinPortListener.run()#Guest#0##n/a#
#af6c4ad0cb2211de9d23c6cd2000e002#SAPEngine_Application_Thread[impl:3]_24#
#0#0#Error##Plain###java.io.IOException: Invalid connection identification byte: 118.
        at com.sap.engine.core.cluster.impl6.JoinPortListener$SocketProcessor.run(JoinPortListener.java:191)
        at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
        at java.security.AccessController.doPrivileged(AccessController.java:219)
        at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
        at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
#com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext.  
Root exception is com.sap.engine.interfaces.cross.DestinationException: cannot establish connection with any of the available instances 
Nested exceptions are: com.sap.engine.services.rmi_p4.exception.P4BaseIOException: Cannot open connection on host:  and port:

Does anyone know how to resolve this problem?

Thanks in advance,

John

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 09, 2009 at 09:30 AM

    Hi John

    Maybe the Context.PROVIDER_URL is not correctly provided. I cannot see this from your message, but keep in mind that P4 port shall be provided (like 50004).

    BR, Siarhei

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2009 at 02:53 PM

    Sorry - should have include how I was getting the serverIP, serverPort and serverId.

    IClusterInformation clusterInfo = (IClusterInformation)PortalRuntime.getRuntimeResources().getService("com.sap.portal.runtime.system.clusterinformation.clusterinformation");
    int clusterElements[] = clusterInfo.getIDClusterElements();
    
    for (int i=0;i<clusterElements.length;i++)
    {
      String serverIP = clusterInfo.getServerIP(clusterElements<i>);
      int serverPort = clusterInfo.getServerPort(clusterElements<i>);
      int serverId = clusterElements<i>;
      ...
    }

    Does look correct? The data I'm getting back for 3 nodes is below.

    ServerName=Server 2 0_48793
    getServerPort=50030
    getServerIP=xx.xx.xx.xxx
    
    ServerName=Server 1 0_48793
    getServerPort=50025
    getServerIP=xx.xx.xx.xxx
    
    ServerName=Server 0 0_48793
    getServerPort=50020
    getServerIP=xx.xx.xx.xxx

    Thanks,

    John

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2009 at 03:28 PM

    I agree. The P4 port for this instance is 50004. When I hard code the port to 50004 and use "force_remote = true" the errors go away but I'm still getting the users from the current node and not all nodes, even though I'm looping through each node.

    Any other ideas?

    Thanks,

    John

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2009 at 03:48 PM

    I am specifying in the PROVIDER_URL the server IP address, server Port and node ID. But I'm always getting data from the current node. Even when I hard-code the cluster ID from another node I always get the data from the current node. And if I put in a bogus server node Id I STILL get data from the current node. It seems as if the code is ignoring the forced remote server node id.

    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); 
    env.put(Context.PROVIDER_URL, "xx.xx.xx.xxx:50004#4879352");
    env.put("force_remote", "true");
    
    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(); // list of sessions on given server in a cluster

    Any ideas why this would be happening?

    Thanks,

    John

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi John,

      i didn't watch the thread, so ma reply is a little late. We are on

      sap.com/SAP-JEECOR 7.01 SP4 (1000.7.01.4.0.20090417015900) 20090721171323

      sap.com/SAP-JEE 7.01 SP4 (1000.7.01.4.0.20090417015900) 20090721171123

      Kernel Version: 7.01 PatchLevel 58805.

      It seems strange to me, that it doesn't work for you. I'm sorry, I don't have any other clue.

      best Regards,

      Christian