XML Deployment Descriptors

In EJB 1.0, the deployment descriptor information is stored in a serializable class defined in the javax.ejb.deployment package. While at first this appeared to be an excellent approach, it has limitations. It isn’t clear which deployment information should be set by the bean developer and which by the deployer. In addition, the serializable classes are not very extensible and limit your ability to describe the bean’s attributes.

To solve these problems, EJB 1.1 replaces the serializable deployment descriptor with an XML-based deployment descriptor. The XML deployment descriptor is defined by an XML DTD (Document Type Definition) that describes the structure that the XML deployment descriptors must have to be considered valid. The XML format is superior to the previous serializable object approach in many ways. First, it’s more informative, allowing description tags to be associated with major elements so that the author can describe, in plain language, the purpose and expected behavior of attributes. Second, XML deployment descriptors can be viewed and edited using any text editor; the serializable deployment descriptor used in EJB 1.0 must be manipulated in a Java program (unless you’re fluent in byte code!). Third, XML is more extensible and less fragile. In EJB 1.0, there are still problems with inconsistent versions of the deployment descriptor. As the specification evolves, the serializable deployment descriptor package would need to change, which ...

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