Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

EAR (file format)

From Wikipedia, the free encyclopedia
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "EAR" file format – news ·newspapers ·books ·scholar ·JSTOR
(February 2025) (Learn how and when to remove this message)
Enterprise Archive
Filename extension
.ear
Internet media typeapplication/java-archive
Developed bySun Microsystems
Type of formatfile archive,data compression
Extended fromJAR

EAR (EnterpriseArchive) is afile format used byJakarta EE for packaging one or more modules into a single archive so that the deployment of the variousmodules onto anapplication server happens simultaneously and coherently. It also containsXML files calleddeployment descriptors which describe how to deploy the modules.[1]

Ant,Maven, orGradle can be used to build EAR files.

File structure

[edit]

An EAR file is a standardJAR file (and therefore aZip file) with an .ear extension, with one or more entries representing the modules of the application, and a metadata directory calledMETA-INF which contains one or more deployment descriptors.

  • META-INF/
    • application.xml: This is the main deployment descriptor for the EAR. It lists all the modules included in the EAR and specifies configuration settings.
    • MANIFEST.MF: The manifest file that provides metadata about the archive.
  • JAR Files:
    • These files contain Enterprise JavaBeans (EJB) modules or utility classes. Each JAR file usually has its ownMETA-INF directory with deployment descriptors specific to the JAR module.
  • WAR Files:
    • These files contain web modules, including servlets, JSP files, HTML files, and other web resources. Each WAR file typically has the following structure:
      • WEB-INF/
        • web.xml: The deployment descriptor for the web module.
        • classes/: Contains compiled Java classes.
        • lib/: Contains library JAR files used by the web module.
  • RAR Files:
    • These files contain resource adapters, typically used to connect to enterprise information systems (EIS).[1]

Module

[edit]

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 aweb applicationdeployment descriptor. The web module is contained in ahierarchy of directories and files in a standard web application format.
  • POJO Java classes may be deployed in.jar files.
  • AnEnterprise Java Bean module has a.jar extension, and contains in its ownMETA-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 andSession Beans are available for remote access.
  • AResource Adapter module has a.rar extension.[2]

Class isolation

[edit]

Most application servers load classes from a deployed EAR file as an isolated tree of Javaclassloaders, 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.

TheJBoss 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. TheUnified 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.[2]

META-INF directory

[edit]

TheMETA-INF directory contains at least theapplication.xml deployment descriptor, known as theJava 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 forsmall-icon andlarge-icon.
  • display-name, which identifies the application
  • description
  • Amodule element for each module in the archive
  • Zero or moresecurity-role elements for the global security roles in the application

Eachmodule element contains anejb,web orjava element which describes the individual modules within the application. Web modules also provide acontext-root which identifies the web module by its URL.

Next to the Jakarta EE deployment descriptor there can be zero or moreruntime deployment descriptors. These are used to configure implementation-specific Jakarta EE parameters.[2]

See also

[edit]

References

[edit]
  1. ^"EAR file overview".www.ibm.com. 2018-04-19. Retrieved2025-02-25.
  2. ^abc"Step 6: Install the Enterprise Application Archive file".www.ibm.com. 2019-06-04. Retrieved2025-02-25.

External links

[edit]
Archiving only
Compressing only
Archiving
and compressing
Software packaging
and distributing
Document packaging
and distributing
Retrieved from "https://en.wikipedia.org/w/index.php?title=EAR_(file_format)&oldid=1279640717"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp