Wrong Lookup From Another Cluster
A server-side client tries to look up an object from a remote AS Java cluster (not from the AS Java cluster on which the client is running), but the returned object comes from the local server process naming system.
Scenario Type: Error analysis
SAP NetWeaver Component: Application Server Java (AS Java)
A client that is running on a certain server process in an AS Java cluster can get context to the naming system of another cluster or instance.
When getting a new initial context, you pass a Hashtable with environment properties to the constructor. If you want to get an initial context from a remote server process, you have to specify another environment property, namely force_remote with its value set to true. Otherwise, even if you state the provider URL to another server process, it will be ignored and you will again get the initial context from the same server process.
When getting the initial context, set the property force_remote with its value set to true..

Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); env.put(Context.PROVIDER_URL, "<host>:<port>); env.put(Context.SECURITY_PRINCIPAL, "<user>"); env.put(Context.SECURITY_CREDENTIALS, "<password>"); env.put("force_remote", "true");
Context jndiCtx = new InitialContext(ctxProp); LookupInterface result = (LookupInterface) jndiCtx.lookup(“lookup name”);
|