Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use of JNDI  RSS feed

 
Amol H Lekurwale
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to use JNDI. I want to know, that how do we bound our object to a particular 'name', and what do we mean by that. Also, if binding to a name and then looking up using the name to obtain a reference to this object, does this mean that I can access to any object running on any JVM on the internet? Or it means that looking up and obtaining the reference is only meant for the same JVM on which JBoss/any server providing the JNDI service is running.

Regards,
Amol Lekurwale
 
Uppala Ramana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to use JNDI. I want to know, that how do we bound our object to a particular 'name', and what do we mean by that. Also, if binding to a name and then looking up using the name to obtain a reference to this object, does this mean that I can access to any object running on any JVM on the internet? Or it means that looking up and obtaining the reference is only meant for the same JVM on which JBoss/any server providing the JNDI service is running.


We can bind the object to a name by using the InitialContext's bind API.
bind(name,object);

You can lookup the object by using lookup(name) and this returns you the object that mapped to the name.

I think lookup only works for the same JVM.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each application server will usually provide a Naming Service, which listens for connections on a well-known port. The connection properties you create include the URL/Port of this service, such that you can connect to any service running anywhere on the Internet.

Best Regards,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!