Summary : EAR can contain WAR and JAR in it
WAR (Web Archive) is a module that goes into web container of J2EE/JEE application server. JEE application server has two containers (run time environments) - one is web container and other is EJB container
Web container hosts web applications based on JSP/Servlets API - designed specifically for web request handling - more of request/response distributed computing. Web container requires the web module to be packaged in WAR file that is special JAR file with web.xml file in WEB-INF folder
EJB container hosts enterprise java beans based on EJB API designed to provide extended business functionality such as declarative transactions, declarative method level security and multi protocol support - more of RPC style of distributed computing. EJB container required EJB module to be packaged in JAR file having ejb-jar.xml file in META-INF folder.
Enterprise application may consist of one or more than modules that can either be Web modules (packaged in WAR file) or EJB modules (packaged in JAR file) or both of them. Enterprise applications are packaged in EAR file that is special JAR file containing application.xml file in META-INF folder
Basically EAR file is superset containing WAR file and JAR files. JEE application servers allow deployment of standalong web modules in WAR file though internally they create EAR file as wrapper around WAR files. Standalone web container such as tomcat and jetty donot support EAR files - these are not full fledged application servers. Web applications in these containers are to be deployed as WAR file only.
In application servers - EAR file contains configuration such as application security role mapping, EJB reference mapping and context root url mapping of web modules
Apart from Web modules and EJB modules EAR files can also contain connector modules packaged as RAR files and Client modules packaged as JAR files
No comments:
Post a Comment