File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Applying JNDI and its concepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Applying JNDI and its concepts" Watch "Applying JNDI and its concepts" New topic
Author

Applying JNDI and its concepts

Senthil Kumar Sekar
Ranch Hand

Joined: Aug 08, 2010
Posts: 45

[color=blue]
Hi,
Can anyone tell me what is the purpose of JNDI.I went through many articles.But iam not getting the purpose of JNDI.
Please correct me if iam wrong anywhere.

Below is my understanding and Questions about JNDI API

It has two services - Naming and Directory Services.

1) Naming Services are used to locate an object which is mapped with a name.So, its a named object.
Eg: A File say temp.txt will be mapped to an object and whenever an application needs the file to be read/manipulated,we look up with the name associated and do the needful.

Question - I can also do the same thing by opening the file provided it should be any place in the SERVER and the code should locate it.Correct?In JNDI, we are mapping the file (that is again available in the SERVER) and retreive it.What is the difference here?


2) Directory Services - Using this service, we can have additional attributes.Can't we achieve the same by defining below in a property file and accessing it.What is the purpose of Directory services.

cn: Qusay H. Mahmoud
mail: qmahmoud@javacourses.com
telephoneNumber: 123-4567


Below is the code snippet that i got from Sun site




In the above code, where exactly the binding is done? Is it in new InitialContext() statement?

'obj' - Does it represents the File Object?Can i use this object for reading the file?

What exactly happens in new InitialContext() statement?


Thanks.

Regards
Senthil Kumar Sekar[/color]
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
One of the advantage is "Location Transperancy".
Your application does not need to know physical location of deployed object if it is bound to JNDI tree.

Regards,
Amit
Senthil Kumar Sekar
Ranch Hand

Joined: Aug 08, 2010
Posts: 45

Can anyone respond to the other questions of mine?It will be helpful for my understanding.

Thanks.

Regards
Senthil Kumar Sekar
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
The Java Naming and Directory Interface API is an advanced API typically used in building complex applications such as an application server or a web server, e.g. WebSphere. Developers that create applications which are "hosted" on these applications rarely write code using JNDI API.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applying JNDI and its concepts
 
Similar Threads
Problem in JNDI lookup
Jndi - can't find
how to connect EJB without using runclient
NoClassDefFoundError calling entitybean from a session bean
WebSphere 5