• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI on a cluster

 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm maintaining some old EJB code. Right now, there is a Session Bean method that stores a piece of information into JNDI. The next time the method runs, it reads the information back. That seems to work fine now, but I suspect that if we ever deploy to a cluster, there will be problems. The second time the method is run could be on a different server with a different JNDI tree. Am I right about that?
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Man, did you ever open a can of worms with me.

JNDI is an important topic, and there are many ways to configure JNDI names. The need for using JNDI references in the deployment descriptors embodies the fact that actual JNDI names can change, and programs must be ready for that.

With WebSphere, we have the whole federated namespace, which actually provides about 5 potential means of doing a JNDI indirection, all of which make sense in various situations. It's alot to digest when you're just happy that your JNDI lookup on your local machine worked properly.

Here's an article I wrote on JNDI. It's WebSphere focussed, but the ideas are universal.

Jndi Bindi Bo Bindi Bannana Fana FoFndi Me Mi MoMndi JNDI

Cheers!

-Cameron McKenzie
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It also depends on the cluster implementation. Since I know JBoss I can let you know how it is implemented. In JBoss, JNDI is replicated, so in the jndi.properties file you can either provide a Multi-cast IP address for the cluster at large, and it can get the information. Or you can provide each and every IP address in the cluster.

Since JNDI is replicated, how it is replicated comes into play on whether it is synchronous replication or asynchronous. with asynchronous, it is possible that the last say 20 seconds of changes hasn't been received on the new node that you are now talking to, but that is a trade off that you need to figure out because how ofter in your cluster does a node go down. Also if you have synchronous, then performance is hit.

Lots about this subject, that research is in order.

Mark
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Since JNDI is replicated, how it is replicated comes into play on whether it is synchronous replication or asynchronous


I believe with JNDI replication you replicate the copy of JNDI tree on the other nodes of the cluster but not the object's binded to the JNDI. I too have question on this.

Assuming I have two servers A, B and user call is routed to Server A which initialize a object (since first time) and binds to JNDI tree. The object bounded by Server A lives in Server A JVM, isn't it?
- What will happen if Server A which created and bounded the Object to JNDI goes down? Sure Server B will have replicated the JNDI copy of Server A but will it be able to resolve the object bounded by Server A?
- Or is the object bounded to server A is replicated on Server B? I guess this will have more memory/performance/version problems
- In weblogic we need to specify the objects (EJB Stub) that are to be replicated in the configuration which make me believe replication is not the default option. I couldn't find a way to create any object, bind to JNDI and get it replicated.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic