EJB deployment descriptor top-level elements
This tip, excerpted from InformIT, offers a discussion of the top-level elements necessary for
Paul Perrone is the author of Building Java Enterprise Systems with J2EE.
Java 2 platform, Enterprise Edition (J2EE) enterprise applications are made up of one or more individual J2EE modules. J2EE modules have deployment descriptors specific to the module type, and J2EE enterprise applications also have their own deployment descriptor format.
J2EE EJB application module deployment descriptors are defined in XML files named ejb-jar.xml. Here I describe elements of the EJB deployment descriptor as they become relevant to the topic at hand. I thus carve out pieces of the XML EJB module and describe them as the elements they define become relevant. If you are new to XML and XML DTDs, I encourage you to review the basics of XML and DTD structure now. At the very least, I will provide examples of what XML files that adhere to the DTD schema specifications should look like.
The top-level elements of an EJB deployment descriptor, shown in the listing, are elements used to define EJB application metadata, EJB structure, assembly information, and the archive filename for any EJB client files. EJB application module deployment descriptors defined according to such a format must also include a standard DOCTYPE definition referencing the standard DTD. The basic top-level structure of an EJB deployment descriptor thus follows the sample form in the Listing.
EJB DTD Top-Level Elements
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.// [ic:ccc]DTD Enterprise JavaBeans 1.1//EN" [ic:ccc] "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd"> <ejb-jar> <description> This is my BeeShirts.com EJB Application </description> <display-name> BeeShirts.com Application Service </display-name> <small-icon> beeshirtsSmall.jpg </small-icon> <large-icon> beeshirtsLarge.jpg </large-icon> <enterprise-beans> <session> ... </session> <session> ... </session> <entity> ... </entity> <entity> ... </entity> ... </enterprise-beans> <assembly-descriptor> ... </assembly-descriptor> <ejb-client-jar> beeshirtsClient.jar </ejb-client-jar> </ejb-jar>
To read the article from which this tip was excerpted, click over to InformIT. You have to register there, but the registration is free.
This was first published in November 2001