Is there any way to look for a Object on another AppServer? For ex: On 1st AppServer, I am binding an object using javax.naming.Context context = new javax.naming.InitialContext(); context.bind("objectName", object); Now from another AppServer, is it possible to access this object using JNDI lookup or some other means. Please note that we are not using any EJB, our environment is: WAS 4.0, DB2 7, AIX. Thanks in advance. Sushil Singh
In WebSphere there is a single, shared JNDI namespace that crosses all application servers and clones in the domain. That shared JNDI namespace is held in the administrative database. Your question, therefore, in one respect doesn't make sense since you are always connecting to other application servers, or never, as the case may be... Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Hi Kyle: Thanks for your reply. As you said that "In WebSphere there is a single shared JNDI namespace" that means we should be able to lookup objects between different AppServer. I will appreciate if you can provide me more details. We are having Vertical clones and each clone is doing its own CACHING (Application data retrieved from DB). This information is 100% same. I was wondering that if only one clone will do the caching and other clone will simply copy CACHE information. This way we will save same resources and the StartUp time for our server. Thanks in advance. Sushil Singh
We are having our own caching mechanism which is internal to our application. Whenever we restart the AppServer or when AppServer recieves some trigger (which indicates that we got new data), we load/reload all the DATA and store into JVM memory. We use Hashmap to do this caching. Thanks. Sushil Singh
posted 19 years ago
OK, At least I understand that now. Now, how are you loading this cache? From a database? WebSphere's JNDI implementation allows you to place just about any serializable object that you want in the naming service. Thre is not a unique name service for each clone (or application server), instead it is shared among all of them. However, here's the problem -- the JNDI server is based on a database also (the admin database). It will probably not be faster to look things up from JNDI than it will be to have each app server load them up directly from your own database and cache them themselves. Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Hi Kyle: Thanks for your reply. I did a small test to verify whether its possible to perform lookup between AppServer (same NODE). But I was not sucessful. Following is the sequence which I am following: On AppServer 1: =============== 1. Context ctx = new InitialContext(); 2. ctx.bind("objName", testObject); 3. Perform lookup to double check: ctx.lookup("objName") - Sucessful On AppServer 2: (Same Node) ============================= 1. Context ctx = new InitialContext(); 2. Object testObject = (Object) ctx.lookup("objName") - FAILED javax.naming.NameNotFoundException Then I tried another combination on AppServer 2: 1. Properties p = new Properties() 2. p.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory"); 3. p.put(Context.PROVIDER_URL", "iiop://<ip address>:900"); 4. Context ctx = new InitialContext(p); 5. ctx.lookup("objName") - FAILED javax.naming.NameNotFoundException If WebSphere share same namespace then I should be able to perform lookup. Am I missing somethin! Thanks. Sushil Singh