Java - Deployment descriptors (Metadata)

Java Conceptuel Diagram


Deployment descriptors are XML documents included in the JARs that describes:

  • component's configuration,
  • deployment settings of an application, a module, or a component
  • of and instructions to the J2EE container.

An enterprise bean module deployment descriptor, for example, declares transaction attributes and security authorizations for an enterprise bean.

Because deployment descriptor information is declarative, it can be changed without modifying the source code. At run time, the J2EE server reads the deployment descriptor and acts upon the component accordingly.

Most J2EE vendors (Application server) provide a GUI tool for generating deployment descriptors and performing deployment because creating manual entries is tedious and error prone.


The two types of deployment descriptors are:

  • Java EE
  • and runtime.


A Java EE deployment descriptor is defined by a Java EE specification and can be used to configure deployment settings on any Java EE-compliant implementation.


A runtime deployment descriptor is used to configure Java EE implementation-specific parameters.

For example, the GlassFish Server runtime deployment descriptor contains such information as the context root of a web application, as well as GlassFish Server implementation-specific parameters, such as caching directives. The GlassFish Server runtime deployment descriptors are named sun-moduleType.xml and are located in the same META-INF directory as the Java EE deployment descriptor.

Deployment descriptor for


The following summarizes the new functionality and simplifications made in EJB 3.0 to the earlier EJB APIs:

  • You are no longer required to create the EJB deployment descriptor files (such as ejb-jar.xml).
  • You can now use metadata annotations in the bean file itself to configure metadata.
  • You are still allowed, however, to use XML deployment descriptors if you want;
  • In the case of conflicts, the deployment descriptor value overrides the annotation value.
  • The only required metadata annotation in your bean file is the one that specifies the type of EJB you are writing (@javax.ejb.Stateless, @javax.ejb.Stateful, @javax.ejb.MessageDriven, or @javax.persistence.Entity).
  • The default value for all other annotations reflect typical and standard use of EJBs.

This reduces the amount of code in your bean file in the case where you are programming a typical EJB; you only need to use additional annotations if the default values do not suit your needs.

The deployment descriptor resides in the META-INF directory inside the EJB JAR file. A JAR can contain multiple beans.


The standard Java EE deployment descriptor. The ejb-jar.xml may be used to define EJBs and to specify standard configuration settings for the EJBs. An ejb-jar.xml can specify multiple beans that will be deployed together.


WebLogic Server-specific deployment descriptor that contains elements related to WebLogic Server features such as clustering, caching, and transactions. This file is required if your beans take advantage of WebLogic Server-specific features. Like ejb-jar.xml, weblogic-ejb-jar.xml can specify multiple beans that will be deployed together.


WebLogic Server-specific deployment descriptor that contains elements related to container-managed persistence for entity beans.


In J2EE, a WAR file is typically contained within an EAR file. In the example in the preceding section, the EAR file, J2EEAppName.ear, would have its /META-INF directory at the top level, along with Web module WAR files, EJB module JAR files, client application JAR files, and resource adapter RAR files (zero or more of each, as applicable):

   orion-application.xml (optional)

The following examples show the structure of the archive files for a simple Web application. The EAR file contains a WAR file, which contains a single servlet.

Discover More
Java Conceptuel Diagram
J2EE - Component Registration

The component registration in a J2EE Application server is defined through: an annotation of a deployment descriptor
Java Conceptuel Diagram
J2EE - Web.xml (Deployment descriptor of a Web Application)

The web.xml file is the deployment descriptor file for a web application. It's a J2EE standard XML document that configures the contents of a WAR file. You can override any of the default servlet parameters...
Card Puncher Data Processing
JPA - orm.xml (Mapping Descriptor files)

orm.xml is a deployment descriptors describing the object-relational mapping. The Xsd Schema file can be found: orm_2_0.xsd or in the specification...
Java Conceptuel Diagram
Java - (Descriptor|Metadata)

Example of (Descriptor|Metadata) implementation in java. The source of the descriptor can be: in the code in an external file (xml, properties, ...) or generated (see ) The java/lang/Class...
Java Conceptuel Diagram
Java - Annotations

Since Java version 1.5. An annotation is an element of the java programming language (modifier or Metadata tag) that can be associated with: Java classes, interfaces, constructors, methods,...
Java Conceptuel Diagram
Java - Application

An application in shipped in an archive format with a main class that contains a main method that starts the application. instancejava/lang/Runtimeclass RuntimeOperating System environment ...
J2ee Ear Structure
Java - Packaging, Archive, Library (JAR, WAR, EAR File)

For deployment purpose, J2EE applications are delivered and reside in Archive files (or unit). A RAR, WAR or EAR file is a standard JAR (.jar) file with a .war or .ear extension. Each archive extension...
Java Conceptuel Diagram
Java - Web Application (Web Module) - War

Web application in Java. A Java web application serve and/or generates interactive HTML web pages. An enterprise application may contain zero or more web applications. A web application is generally...
Card Puncher Data Processing
Weblogic - EjbGen

EJBGen is a tool to generate deployment descriptors. Instead of editing and maintaining all of the multiple component files of an EJB, EJBGen lets you work with only one specially annotated bean class....
Card Puncher Data Processing
Weblogic - Getting Started EJB with a stateless session enterprise JavaBean

A complete stateless session enterprise JavaBean Clients access a session or entity bean through the bean's interfaces. The EJB container generates the interface implementations to enforce and manage...

Share this page:
Follow us:
Task Runner