JNDI - Java Naming Directory Interface is a protocol based on TCP/IP that aims to be ... well ... what it says.
RMI - Remote Method Invocation is again another protocol, which aims to be a Java *replacement* for RPC - remote method invocation across distriubted servers.
The "rmiregistry" is a server process that RMI object register their "presence" with; it usually listens on port 1099 - and is required for a server to use "RMI" - though a client need not run a rmiregistry process - thats the point - the client looks up the registry on port 1099, to see what servers (JVM sense) are registered.
RMI and JNDI are completely different - its like saying "Whats the difference between a car and a bicycle ?". Answer is - they are both means to an ends.
Sedj,
So sounds like both are primarily used for similar purposes..may be JNDI provides more services than just registry and lookups (like rmiregistry)? Did I understand right?
no, they are very different. JNDI provides a "naming and directory service" within a JVM, RMI provides the ability to execute procedures in a remote JVM from another [remote] JVM.
Sedj,
Here we are not comparing JNDI and RMI. We are comparing JNDI and rmiregistry...so don't they provide a similar service..like the ability to store named-object-instances..!!
The rmiregistry is not comparable to JNDI at all (except on a really abstract level).
JNDI is an API and a protocol. The rmiregistry is a programme.
You cannot compare JNDI and the rmiregistry - its like comparing a car to a recipe - its just not comparable.
Talking about rmiregisty without talking about RMI as a protocol/API is just pointless. The rmiregistry programme is something that facilitates the lookup of RMI based objects between remote JVMs - completely different to the concept of JNDI that is an API that allows the lookup and binding of objects in a local JVM. If there were such a thing as a "jndiregistry" then maybe you could compare the two - but that does not exist - because JNDI is an API - not a programme.
Maybe on a completely abstract level, you could say that JNDI, as a means to looking up an "object" is similar to the rmiregistry programme, because they both, at a certain level "look up" an entry - but then you would have to say that email is the same as rmiregistry, as is the index of a book, or the search functionality in a word processor - because they all provide the ability to "look up something". But then thats just stupid.
Just accept that, while RMI and JNDI have some comparisions, they are in effect, and more importantly practically, very different concepts.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.