Interview Questions.

Top 100+ Jndi (java Naming And Directory Interface) Interview Questions And Answers


Top 100+ Jndi (java Naming And Directory Interface) Interview Questions And Answers

Question 1. What Is A Naming Service?

Answer :

Naming services map items with names. It maps a connection with an item by a user friendly call. For example a device maps its ip cope with. The association of an object with a call is called ‘binding’. Examples : Domain Naming Service, File structures.

Question 2. Can You Explain Why We Need Jndi If Communication To Systems Via Ldap Is Possible?

Answer :

JNDI is likewise used to lookup resources like a database or a message queue. With JNDI you get a uniform manner to get right of entry to directory services.

AJAX Interview Questions
Question three. Explain The Importance Of Jndi?

Answer :

To centralize the records garage the companies uses LDAP. The information is of person names, passwords, email addresses, printers, dedication of database get right of entry to. Multiple database control is decreased with the aid of centralizing the information.

Question 4. What Is A Directory Service?

Answer :

Searching for files and directories executed via supplying Directory services. A directory provider is a fixed of names. The consumer and useful resource statistics and device addresses are summarized with the aid of directory carrier. For example, for a given consumer call, the provider returns the attributes of the consumer along with smartphone no, email address and many others. A listing carrier use the databases that specialized and hierarchical in design.

AJAX Tutorial
Question five. Tell Me What Do You Know About Ldap?

Answer :

Lightweight Directory Access Protocol Developed by using the University of Michigan.

It is a protocol for finding agencies, individuals, and different assets inclusive of documents and devices in a network, whether or not on the public Internet or on a corporate intranet.

JMS(Java Message Service) Interview Questions
Question 6. How Do We Use Ldap To Work With A Directory Service?

Answer :

At the time of advent of the databases, the present LDAP will acquire the database server example and the database information is furnished to the LDAP listing after the creation of the databases.
The catalog records for the server may be retrieved for the directory of LDAP, at the time of the patron’s connection to the database.
The catalogue information want not be stored regionally on each machine for the clients.
The LDAP listing may be searched via the patron applications for the wanted records with the intention to connect with the database.
Question 7. Uses Of Ldap?

Answer :

A massive no. Of machines can have a not unusual list of login customers.
Reading accesses and responsiveness is fast.
LDAP may be used to cluster whilst failover occurs.
EJB(Enterprise JavaBeans) Tutorial EJB(Enterprise JavaBeans) Interview Questions
Question eight. What Do You Know About The Directory Service Of Jndi?

Answer :

Searching for files and directories carried out by way of supplying Directory offerings. A directory carrier is a set of names. The consumer and aid statistics and device addresses are summarized by using directory service. For instance, for a given user call, the provider returns the attributes of the person along with cellphone no, email deal with and many others. A listing carrier use the databases that specialized and hierarchical in design.

Question nine. What Is Jndi ? And What Are The Typical Uses Within A J2ee Application ?

Answer :

JNDI stands for Java Naming and Directory Interface. It offers a popular interface to LDAP (Lightweight Directory Access Protocol) and different directory offerings like NDS, DNS (Domain Name System) and many others. It affords a means for an utility to discover components that exist in a call area in keeping with positive attributes.

A J2EE software thing makes use of JNDI interfaces to appearance up and reference gadget-furnished and user-described items in a aspect environment. JNDI is not particular to a specific naming or listing provider. It can be used to get admission to many different types of structures such as report systems. The JNDI API permits programs to appearance up items along with DataSources, EJBs, MailSessions, JMS connection factories and locations (Topics/Queues) by call.

The Objects may be loaded into the JNDI tree using a J2EE application server's administration console. To load an object in a JNDI tree, pick a call underneath that you want the object to appear in a JNDI tree. J2EE deployment descriptors indicate the placement of J2EE additives in a JNDI tree. The parameters you have to outline for JNDI provider are as follows:

The call service issuer elegance name (WsnInitialContext for WebSphere software server).

Hashtable env = new Hashtable();


The provider URL :
The name carrier hostname.
The name service port wide variety. 
Env.Put(Context.PROVIDER_URL, " iiop://localhost:1050");
Context ctx = new InitialContext(env); 

Simple Mail Transfer Protocol (SMTP) Interview Questions
Question 10. Explain The Difference Between The Look Up Of "java:comp/env/ejb/mybean" And "ejb/mybean" ?

Answer :

java:comp/env/ejb/MyBean: This is a logical reference, with the intention to be used to your code.

Ejb/MyBean: This is a physical reference where an object can be mapped to in a JNDI tree.

The logical reference (or alias) java:comp/env/ejb/MyBean is the recommended technique due to the fact you cannot guarantee that the physical JNDI vicinity ejb/MyBean you specify in your code might be available. Your code will break if the physical place is changed. The deployer will now not be capable of alter your code. Logical references clear up this trouble through binding the logical call to the bodily name inside the application server. The logical names may be declared inside the deployment descriptors (internet.Xml and/or ejb-jar.Xml) as follows and these might be mapped to physical JNDI locations within the utility server precise deployment descriptors. To look up a JDBC aid from either Web (web.Xml) or EJB (ejb-jar.Xml) tier, the deployment descriptor need to have the subsequent entry: 

<description>The DataSource</description>

To use it: 

Context ctx = new InitialContext();

Object ref = ctx.Lookup(java:comp/env/jdbc/MyDataSource); 

To look up EJBs from every other EJB or a Web module, the deployment descriptor should have the subsequent entry: 


To use it: 

Context ctx = new InitialContext();
Object ref = ctx.Lookup(java:comp/env/ejb/MyBean); 

JavaMail API Tutorial
Question eleven. What Is A Jndi Initialcontext ?

Answer :

All naming operations are relative to a context. The InitalContext implements the Context interface and presents an entry factor for the decision of names.

JavaMail API Interview Questions
Question 12. What Is An Ldap Server ? And What Is It Used For In An Enterprise Environment ?

Answer :

LDAP stands for Lightweight Directory Access Protocol. This is an extensible open network protocol general that provides get entry to to allotted listing offerings. LDAP is an Internet widespread for listing offerings that run on TCP/IP. Under OpenLDAP and related servers, there are  servers slapd, the LDAP daemon in which the queries are despatched to and slurpd, the replication daemon in which statistics from one server is pushed to 1 or greater slave servers. By having more than one servers hosting the identical information, you could increase reliability, scalability, and availability.

It defines the operations one may also perform like seek, upload, delete, alter, change name
It defines how operations and records are conveyed.
LDAP has the ability to consolidate all the present software precise information like user, enterprise cellphone and e mail lists. This method that the change made on an LDAP server will take effect on each listing service based totally application that makes use of this piece of person facts. The kind of records about a new user may be introduced via a unmarried interface which will be made available to Unix account, NT account, e-mail server, Web Server, Job particular information groups and so on.

When the person leaves his account can be disabled to all of the offerings in a unmarried operation. So LDAP is maximum beneficial to offer "white pages" (e.G. Names, smartphone numbers, roles etc) and "yellow pages (e.G. Location of printers, software servers and so forth) like offerings. Typically in a J2EE software surroundings it'll be used to authenticate and authorize users.

AJAX Interview Questions
Question thirteen. Why Use Ldap When You Can Do The Same With Relational Database (rdbms) ?

Answer :

In trendy LDAP servers and RDBMS are designed to offer specific forms of offerings. LDAP is an open popular access mechanism, so an RDBMS can communicate LDAP. However the servers, which can be constructed on LDAP, are optimized for study access so probably to be lots quicker than RDBMS in presenting study get right of entry to. So in a nutshell, LDAP is greater beneficial when the information is regularly searched but rarely modified. (Another difference is that RDBMS structures keep statistics in rows of tables while LDAP uses object oriented hierarchies of entries.) . Key LDAP Terms:

DIT: Directory Information Tree. Hierarchical shape of entries, those make up a listing.
DN: Distinguished Name. This uniquely identifies an access in the directory. A DN is made up of relative DNs of the access and every of access's discern entries up to the root of the tree. DN is study from right to left and commas separate these names. For instance 'cn=Peter Smith, o=ACME, c=AUS'.
ObjectClass: An objectClass is a proper definition of a selected kind of objects that can be saved inside the listing. An ObjectClass is a wonderful, named set of attributes that represent some thing concrete together with a user, a pc, or an application.
LDAP URL: This is a string that specifies the area of an LDAP aid. An LDAP URL includes a server host and a port, search scope, baseDN, filter out, attributes and extensions.
LDAP schema: defines regulations that explain the forms of objects that a directory may include and the desired non-obligatory attributes that entries of various kinds have to have.
Filters: In LDAP the basic manner to retrieve records is carried out with filters. There is a wide type of operators that may be (or), ! (not), ~= (approx same), >= (more than or identical), <= (less than or identical), * (any) and many others.
Java Bean Utils Tutorial
Question 14. So Where Does Jndi Fit Into This Ldap ?

Answer :

JNDI affords a trendy API for interacting with naming and directory offerings using a provider issuer interface (SPI), which has similarities to JDBC driving force. To connect to an LDAP server, you should acquire a reference to an item that implements the DirContext. In maximum packages, that is executed by means of using an InitialDirContext object that takes a Hashtable as an argument: 

Hashtable env = new Hashtable();
env.Placed(Context.INITIAL_CONTEXT_FACTORY, "com.Solar.Jndi.Ldap.LdapCtxFactory");
env.Positioned(Context.PROVIDER_URL, "ldap://localhost:387");
env.Put(Context.SECURITY_AUTHENTICATION, "easy");
env.Put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
env.Put(Context.SECURITY_CREDENTIALS, "myPassword");
DirContext ctx = new InitialDirContext(env); 

Question 15. Who Should Use Jndi?

Answer :

Any Java utility that desires to access information about users, machines, networks, and services. User statistics includes protection credentials, smartphone numbers, digital and postal mail addresses, and alertness possibilities. Machine records includes network addresses, gadget configurations, etc. In addition, any Java application that wishes to both export items or get entry to objects exported via other applications and offerings. Examples include printers, calendars, and networked document structures.

Java Management Extensions (JMX) Interview Questions
Question 16. Describe What Jndi Is?

Answer :

JNDI is a universal listing API for Java programs. It is similar to the java.Io.File magnificence for getting access to files. 

There is probably some administrative applications that need to govern a document on the protocol level (along with NFS), however usually all Java packages use the File magnificence to access to file machine. 

Similarly, most Java packages must use JNDI to get entry to directories. 

Applications that want to control listing content on the protocol level may additionally choose to use Netscape's API.

Question 17. Where Is Jndi Being Used In The Java Platform?

Answer :

HotJava Views 1.1 is using JNDI to get entry to LDAP.

Enterprise APIs including 

Enterprise JavaBeans
Java Message Service
JDBC 2.Zero
make use of JNDI to for their naming and listing wishes.

RMI over IIOP programs can use JNDI to get admission to the CORBA (COS) naming service.

Mail Server Interview Questions
Question 18. Who Will Provide Implementations Of Jndi?

Answer :

At the time of this writing, IBM, Novell, Sun, and WebLogic have produced carrier providers for JNDI.

JMS(Java Message Service) Interview Questions
Question 19. What Protocols Does Jndi Provide An Interface To?

Answer :

JNDI itself is independent of any precise listing access protocol. Individual provider vendors determine the protocols to guide.

There can be issuer implementations for popular protocols, including LDAP, NDS, DNS, and NIS(YP), provided by unique vendors. 

Question 20. How Does Jndi Relate To Ldap?

Answer :

JNDI offers an notable object-orientated abstraction of listing and naming. 

Developers using JNDI can produce queries that use LDAP or other get right of entry to protocols to retrieve results; however, they're now not confined to LDAP nor do they need to expand their packages stressed to LDAP. JNDI supports the key competencies in LDAP v3.

Java Bean Utils Interview Questions
Question 21. How Does Jndi Relate To Netscape's Java Ldap Api?

Answer :

Netscape's API is LDAP-particular. It is used for low-degree access to LDAP directories. It exposes details about the protocol that applications usually do now not need to realize. 

Question 22. How Does Jndi Relate To Omg's Corba Standards For Naming?

Answer :

A Java CORBA software can use JNDI to get entry to to the CORBA (COS) call carrier, as well as other naming and directory offerings.

It gives the utility one interface for getting access to these kinds of naming and directory services. 

Using JNDI also paves the way for Java CORBA applications to use a distributed corporation-level service like LDAP to keep object references.

Question 23. How Does Jndi Relate To Microsoft's Adsi?

Answer :

The Java ADSI bundle lets in Java applications to get right of entry to Active Directory based totally on the COM model.

Although it could be used to get entry to different directories, it's far a Windows-centric answer. 

JNDI gives Java packages, no matter whether they may be going for walks on Windows or having access to Active Directory, to access directories the usage of the Java item version. 

For instance, you can manipulate gadgets inclusive of AWT and JavaBeans components, bind them into the directory, and appearance them returned up without having to do any translation or address statistics illustration issues.

Apache Wicket Interview Questions
Question 24. What Is Xfn And How Does This Relate To Jndi?

Answer :

XFN is X/Open Federated Naming, a C-primarily based general for having access to more than one, likely federated naming and directory offerings.

A programmer acquainted with XFN will locate it clean to apply JNDI. 

EJB(Enterprise JavaBeans) Interview Questions
Question 25. What About Security?

Answer :

Different directories have special approaches of managing security. 

JNDI lets in for programs to paintings in conjunction with directory-unique safety structures. In the destiny, JNDI-based programs might be capable of take benefit of any single sign-on mechanism advanced for the Java platform.