Chapter 5. The Remote and Local Client View
Developing the Cabin EJB and the TravelAgent EJB may have raised your confidence, but it also may have raised a lot of questions. We have glossed over most of the details involved in developing, deploying, and accessing the enterprise beans. In this chapter and the ones that follow, we will peel away the layers of the Enterprise JavaBeans onion to expose the details of EJB application development.
This chapter focuses specifically on the client’s remote and local view of entity and session beans. The endpoint view, which is used by Web service clients to access stateless session beans, is significantly different and is addressed separately in the Web services chapter, Chapter 14. Message-driven beans are not covered in this chapter either—they are covered in detail in Chapter 12.
Locating Beans with JNDI
In
Chapter 4, the client application started by
creating an InitialContext
, which it then used to
get a remote reference to the homes of the Cabin and TravelAgent
EJBs. The InitialContext
is part of a larger API
called the Java Naming and Directory Interface ( JNDI). We use JNDI
to look up an EJB home in an EJB server just like we might use a
phone book to find the home number of a friend or business associate.
JNDI is a standard Java package that provides a uniform API for accessing a wide range of services. It is somewhat similar to JDBC, which provides uniform access to different relational databases. Just as JDBC lets us write code ...
Get Enterprise JavaBeans, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.