{"id":2394,"date":"2017-07-05T04:45:29","date_gmt":"2017-07-05T04:45:29","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=2394"},"modified":"2017-07-05T04:49:49","modified_gmt":"2017-07-05T04:49:49","slug":"war-vs-ear-vs-jar","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/war-vs-ear-vs-jar\/","title":{"rendered":"WAR vs EAR vs JAR"},"content":{"rendered":"<p>Java Archives (JAR) A JAR file encapsulates one or more Java classes, a manifest, and a descriptor. JAR files are the lowest level of archive. JAR files are used in J2EE for packaging EJBs and client-side Java Applications.<\/p>\n<p>A WAR (Web Archive) is a module that gets loaded into a Web container of a Java Application Server. A Java Application Server has two containers (runtime environments) &#8211; one is a Web container and the other is a EJB container.<\/p>\n<p>The Web container hosts Web applications based on JSP or the Servlets API &#8211; designed specifically for web request handling &#8211; so more of a request\/response style of distributed computing. A Web container requires the Web module to be packaged as a WAR file &#8211; that is a special JAR file with a web.xml file in the WEB-INF folder.<\/p>\n<p>An EJB container hosts Enterprise java beans based on the EJB API designed to provide extended business functionality such as declarative transactions, declarative method level security and multiprotocol support &#8211; so more of a RPC style of distributed computing. EJB containers require EJB modules to be packaged as JAR files &#8211; these have a ejb-jar.xml file in the META-INF folder.<\/p>\n<p>Enterprise applications may consist of one or more modules that can either be Web modules (packaged as a WAR file) or EJB modules (packaged as a JAR file) or both of them. Enterprise applications are packaged as EAR files &#8211; these are special JAR files containing an application.xml file in the META-INF folder.<\/p>\n<p>Basically EAR files are a superset containing WAR files and JAR files. Java Application Servers allow deployment of standalone web modules in a WAR file, though internally they create EAR files as a wrapper around WAR files. Standalone web containers such as Tomcat and Jetty do not support EAR files &#8211; these are not full fledged Application servers. Web applications in these containers are to be deployed as WAR files only.<\/p>\n<p>In application servers &#8211; EAR files contain configurations such as application security role mapping, EJB reference mapping and context root url mapping of web modules.<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java Archives (JAR) A JAR file encapsulates one or more Java classes, a manifest, and a descriptor. JAR files are the lowest level of archive. JAR files are used in J2EE for packaging EJBs and client-side Java Applications. A WAR (Web Archive) is a module that gets loaded into a Web container of a Java&hellip; <a href=\"https:\/\/codethataint.com\/blog\/war-vs-ear-vs-jar\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143],"tags":[],"class_list":["post-2394","post","type-post","status-publish","format-standard","hentry","category-build-tools"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=2394"}],"version-history":[{"count":2,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2394\/revisions"}],"predecessor-version":[{"id":2396,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2394\/revisions\/2396"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=2394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=2394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=2394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}