2

Since Tomcat just unzips the EAR WAR to the filesystem to serve the app, what is the benefit of using an EAR WAR and what are the drawbacks to just pushing a filesystem to the Tomcat webapps filesystem?

Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58
Slartibartfast
  • 1,605
  • 2
  • 16
  • 23

4 Answers4

1

Tomcat supports WAR but not EAR. Anyways , I think your question is about why we normally deploy the application that is packaged as a single WAR rather than the exploded WAR (i.e exploded deployment).

The main advantages for me are :

  • It is more easy to handle the deployment when you just need to deploy one file versus deploying many files in the exploded WAR deployment.

  • Because there is only one file get deployed , we can always make sure the application is running in a particular version. If we allow to deploy individual files and someone just update several files to other version , it is difficult to tell what is the exact version that the application is running.

There are already some discussion about such topics before , you can refer this and this for more information.

Ken Chan
  • 84,777
  • 26
  • 143
  • 172
1

EAR (Enterprise Application aRchive) is not supported by Tomcat (web container).

As you have written Tomcat I guess you are asking about WAR and extracted/exploded WAR.

  • Normally WAR file extracted once it start deploying
  • You can make change in exploded folder, but war will not be deployed again as it is already extracted and changes will be applied
  • Can be deployed even without WAR(extracted folder, will save some seconds)
  • Deployment can be easy with ONE file - Advantage of WAR
  • if deployed extracted, Versions of application can not be identified as you can make changes in already extracted file system - Disadvantage of Extracted
Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58
0

I see some benefits, if you deploy a single war-file

  • If you have multiple environments (ex. test and prod), you have just to move one single file from one Server to another
  • If you want to enshure, that you deploy the correct file, you can calculate a hash-sum from that single file
  • You allwas have an original version: Sometimes you have to edit a file in the exploded war (Try to avoid this). If you have done this and you want to roll it back, you just delete the exploded-war-folder and the tomcat uses the war file
  • you can use the manager-app to deploy the app via your browser so that you don't need access to the server
waXve
  • 792
  • 2
  • 9
  • 30
0

Your question is a bit ambiguous and unclear to me, as it's hard to understand what you try to clarify; however, let's take your points one by one.


Since Tomcat just unzips the EAR to the filesystem to serve the app..

Tomcat can not explode and deploy EAR files, because it does not implement entirety of Jakarta (formerly - Java) EE specification; EAR, however, is an "Enterprise Archive", i.e. an Enterprise Java Application archive, which doesn't fit into subspecifications only.

Rather, Tomcat is a Web Server (often referred as Servlet Container, Servlet Engine, Web Container), which implements:

  1. Servlet API;
  2. JSP;
  3. EL (Expression Language);
  4. Web Socket;
  5. Jakarta Annotations;
  6. Jakarta Authorization,

and all these are sub-specifications of Java/Jakarta EE.

what is the benefit of using an EAR?

EAR is a fully-blown Enterprise (Application) Archive, which brings much more, that just Servlet, JSP, and etc.

what are the drawbacks to just pushing a filesystem to the Tomcat webapps filesystem?

Nothing, generally speaking. webapps is a default folder where Tomcat will usually try to look for a web applications, that are expected to be .war files.

Giorgi Tsiklauri
  • 9,715
  • 8
  • 45
  • 66