Skip to Content
author's profile photo Former Member
Former Member

Problem with JNDI in cluster in SAP WAS SS9

Hello, dear experts.

We have the following problem:

In a clustered SAP WAS SS9 on Win 2K/Oracle/JDK 1.4.2_07, if a server in the cluster is shut down its JNDI entries are still visible by other servers' initial context lookup calls.

Piece of code to reproduce is as follows:

LookupTest.java:

package lookuptest;

import javax.naming.*;

import java.util.*;

public class LookupTest {

private static InitialContext ctx=null;

static {

final Properties props=new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sap.engine.services.jndi.InitialReplicatingContextFactoryImpl");

props.put("Replicate","true");

props.put("clear_cache","true");

try {

ctx=new InitialContext(props);

} catch (NamingException e) {

e.printStackTrace();

}

}

public LookupTest() {

}

public static synchronized String get(String name) throws NamingException {

return (String) ctx.lookup(name);

}

public static synchronized void put(String name, String value) throws NamingException, NameAlreadyBoundException {

ctx.bind(name,value);

}

}

// from JSP

<%

String name=null;

try {

name=LookupTest.get("test");

out.prinltn("Found!");

} catch (NamingException e) {

out.prinltn("Not Found!");

// not found

try {

LookupTest.put("test","test");

} catch (NameAlreadyBoundException e) {

}

}

%>

To reproduce:

Start up a cluster.

Run JSP from both servers in a cluster.

Shut down the SAP WAS server on the node that returned Not Found!.

Run JSP from another server - Found appears, although the originating server went down.

I would really appreciate any comments or suggestions.

Regards,

-Yuri

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 03:42 PM

    In case someone else needs this here is a workaround: In order to solve our problem we've implemented a refresh algorythm ("leasing" strategy) which keeps the entry "fresh" (or leased) for a certain period of time by a server-side timer thread. If server stops refreshing it we assume it's down and clean the entry from JNDI.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.