• Post Reply Bookmark Topic Watch Topic
  • New Topic

jndi initial factory  RSS feed

 
nibla jose
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever we make a jndi look up we specify a set of initial property set. In this one is the url to the server. Another is the initial factory class name.
1. What is this initial factory class?
2. What does it do?
3. Where does it reside, on the client or on the server?
4. If I have webpshere as my server,
a. is it mandatory that i should be giving the name of ibm implementation of the initial factory?
If this is true, wont this mean that a client should be aware of the application server vendor in which the application runs???
b. Or will it work even if i am using sun's initial factory?
If this is true, then what is the use of having different intial context factories. We only need one class right?

Thanks in advance for all kind answers...
 
Steve Wink
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nibla jose wrote:Whenever we make a jndi look up we specify a set of initial property set. In this one is the url to the server. Another is the initial factory class name.
1. What is this initial factory class?
2. What does it do?
3. Where does it reside, on the client or on the server?
4. If I have webpshere as my server,
a. is it mandatory that i should be giving the name of ibm implementation of the initial factory?
If this is true, wont this mean that a client should be aware of the application server vendor in which the application runs???
b. Or will it work even if i am using sun's initial factory?
If this is true, then what is the use of having different intial context factories. We only need one class right?

Thanks in advance for all kind answers...


1. The initial factory class is the class that implements the InitialContextFactory interface. You specify it in configuration so that your code doesn't know or care which implementation is being used.
2. It connects to the JNDI repository (whereever and whatever this is depends on the implementation you are using for example there is a websphere one which will look in websphere's JNDI, there is a sun file based reference implementation which uses a simple text file to put bindings in and so on).
3. The class resides in a jar file which your server will have in its classpath and which your client could have in its classpath if you configure it
4. a. yes to you specify the ibm implementation, but not in your code - in a configuration, typically a jndi.properties file, so your client is still ignorant of the server vendor.
b. no.
If you are using websphere you can run your client via launchclient which automatically sets up all the environment variables and configuration to allow you to use ibms jndi.

Last time I looked the javasoft website had an excellent JNDI tutorial which will teach you pretty much everything you need to know.
 
nibla jose
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

Thank you for your answer, It was so explanaotry. Got a better idea of JNDI. If you can kindly provide me the link to the JNDI tutorial you were talking about.
 
Steve Wink
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JNDI and many more tutorials are here:

http://java.sun.com/docs/books/tutorial/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!