What are the JNDI dependencies?
we are wanting to use a JNDI service with our client applications (开发者_运维知识库all written in Java SE 6) and here is our doubt: what are the dependencies? Does the JVM already comes with all the classes that we'll need to access these services? If not, where can we get them?
Like JDBC (Java Database Connectivity), JNDI is not a service, but a set of interfaces; it allows applications to access many different directory service providers using a standardized API. Just as with JDBC, the JDK contains the JNDI interfaces but does not include a JNDI service provider -- although Sun Microsystems provides adapters for connecting to existing directory service providers, such as LDAP (lightweight directory access protocol), DNS (domain name service), and CORBA. However, you can use one of several free or open source JNDI providers in your J2SE (Java 2 Platform, Standard Edition) applications.
What you're looking for is package javax.naming, which is part of JavaSE 6.
Sun's guide to JNDI.
Now, unless you're building a web application, JNDI is quite a complex beast. If you can afford to bundle Spring with your application, the lookup of an object with Spring is a no-brainer.
Yes, Java comes with all classes necessary to use JNDI. See the tutorial for some examples and explanations.
精彩评论