Chapter 10. XML Deployment Descriptors

What Is an XML Deployment Descriptor?

One of the biggest changes between EJB 1.0 and 1.1 is the introduction of XML deployment descriptors. In EJB 1.0, deployment descriptors were serialized Java objects; you wrote a program that set up an appropriate DeploymentDescriptor, and then serialized that object. This approach was clumsy at best, even for experienced developers. XML deployment descriptors are much easier to edit, even without special tools for editing XML files. An XML deployment descriptor is simple enough that it’s easy to create a descriptor using nothing more than your favorite text editor, be it Notepad, Emacs, or vi.

This chapter discusses what goes into an XML deployment descriptor; it teaches you how to write deployment descriptors for your beans. Keep in mind that you may never need to write a deployment descriptor by hand; most vendors of integrated development tools and EJB servers will provide tools for creating the descriptor automatically. Even if you have such a tool available, however, you should be familiar enough with deployment descriptors to be able to read them on your own.

This chapter doesn’t attempt to teach you how to read or write correct XML. There are many books on the subject; a good quick reference is XML Pocket Reference by Bob Eckstein (O’Reilly). Very briefly, XML looks like HTML, but with different tag names and different attributes inside the tags. You won’t see <h1> and <p> inside a deployment descriptor; ...

Get Enterprise JavaBeans, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.