World Library  
Flag as Inappropriate
Email this Article

EAR (file format)

Article Id: WHEBN0003294492
Reproduction Date:

Title: EAR (file format)  
Author: World Heritage Encyclopedia
Language: English
Subject: PeaZip, EGG (file format), Xz, BagIt, Apple Disk Image
Publisher: World Heritage Encyclopedia

EAR (file format)

Enterprise Archive
Filename extension .ear
Developed by Sun Microsystems
Type of format file archive, data compression
Extended from JAR

EAR (Enterprise ARchive) is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. It also contains XML files called deployment descriptors which describe how to deploy the modules.

Ant, Maven, or Gradle can be used to build EAR files.

File structure

An EAR file is a standard JAR file (and therefore a Zip file) with a .ear extension, with one or more entries representing the modules of the application, and a metadata directory called META-INF which contains one or more deployment descriptors.


Developers can embed various artifacts within an EAR file for deployment by application servers:

  • A Web module has a .war extension. It is a deployable unit that consists of one or more web components, other resources, and a web application deployment descriptor. The web module is contained in a hierarchy of directories and files in a standard web application format.
  • POJO Java classes may be deployed in .jar files.
  • An Enterprise Java Bean module has a .jar extension, and contains in its own META-INF directory descriptors describing the persistent classes deployed. Deployed entity beans become visible to other components and, if remotely exported, to remote clients. Message Beans and Session Beans are available for remote access.
  • A Resource Adapter module has a .rar extension.

Class isolation

Most application servers load classes from a deployed EAR file as an isolated tree of Java classloaders, isolating the application from other applications, but sharing classes between deployed modules. For example, a deployed WAR file would be able to create instances of classes defined in a JAR file that was also included in the containing EAR file, but not necessarily those in JAR files in other EAR files. One key reason for this behavior is to allow complete separation between applications which use static singletons (e.g. Log4J), which would otherwise confuse the configuration between separate applications. This also enables different versions of applications and libraries to be deployed side-by-side.

The JBoss application servers before Version 5 were notable in that it does not isolate deployed components. A web application deployed in one EAR file would have access to classes in other EAR and WAR files. This is a somewhat controversial policy. The Unified Classloader design reduces communications overhead between running applications, as class data can be shared by reference or simple copies. It also allows developers to avoid having to understand the problems that a tree of classloaders can create. However, it prevents different versions of dependent libraries from being deployed in separate applications. JBoss 4.0.2 switched to a hierarchical classloader, but in version 4.0.3 it reverted to a Unified Classloader for backwards compatibility reasons. There is now a configuration option to change this behavior. JBoss 5.x, 6.x and 7.x no longer use Unified Classloading.

META-INF directory

The META-INF directory contains at least the application.xml deployment descriptor, known as the Java EE Deployment Descriptor. It contains the following XML entities:

  • icon, which specifies the locations for the images that represent the application. A subdivision is made for small-icon and large-icon.
  • display-name, which identifies the application
  • description
  • A module element for each module in the archive
  • Zero or more security-role elements for the global security roles in the application

Each module element contains an ejb, web or java element which describes the individual modules within the application. Web modules also provide a context-root which identifies the web module by its URL.

Next to the Java EE deployment descriptor there can be zero or more runtime deployment descriptors. These are used to configure implementation-specific Java EE parameters.

See also

External links

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.