Chapter 16.  XML Deployment Descriptors

What Is an XML Deployment Descriptor?

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 does not 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); XML in a Nutshell, by Elliotte Rusty Harold and W. Scott Means (O’Reilly), provides a more detailed treatment. 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; you’ll see tags like <ejb-jar>. But otherwise, if you expect an XML document to look like HTML, you’re most of the way toward reading it. The tag names and attribute names for an XML document are defined by a special document called a Document Type Definition (DTD). Therefore, for XML deployment descriptors, there is a DTD that defines the tags and attributes that can be used in the document; the DTDs for deployment descriptors in EJB 2.0 and 1.1 are available online at

Get Enterprise JavaBeans, Third 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.