O'Reilly logo

Enterprise JavaBeans, Fourth Edition by Richard Monson-Haefel, Bill Burke, Sacha Labourey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. XML Deployment Descriptors

This chapter teaches you how to write XML deployment descriptors for your beans. You may never need to write a deployment descriptor by hand: most vendors of integrated development tools and EJB servers provide tools for creating the descriptor automatically. Even if you have such a tool available, however, you must be familiar with deployment descriptors: the ability to read a deployment descriptor is an essential skill. This chapter does not attempt to teach you how to read or write correct XML. There are many books on the subject: XML Pocket Reference by Bob Eckstein (O’Reilly) is a good quick reference; 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 attributes inside the tags. You won’t see <h1> and <p> inside a deployment descriptor; instead, you’ll see tags like <ejb-jar>. But if you’re familiar with the structure of HTML, you’re most of the way towards reading XML. The tag names and attribute names for an XML document are defined by a special document called an XML Schema Definition (XSD). (EJB 2.0 used an older kind of definition document called a Document Type Definition (DTD)). An XSD or DTD defines the tags and attributes that can be used in a deployment descriptor, as well; the XSDs for deployment descriptors in EJB 2.1 and the DTDs for EJB 2.0 are available online at http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required