Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why actually there is any need of WAR files in Tomcat?

Why don't one just put files in a sub directory under webapps directory? Are there any advantages of WAR in server performance?

like image 689
DDC Avatar asked Dec 07 '22 15:12

DDC


2 Answers

There is no performance benefit in using WAR files. Indeed, a typical web container unpacks the deployed WAR file into the the webapp's directory before running the webapp ... and this takes time.

The real benefit of WAR and EAR files is in simplicity of deployment ... assuming that you are not doing something unsound like developing code on a live production server.

like image 181
Stephen C Avatar answered Dec 20 '22 12:12

Stephen C


WAR files are pretty much just archives, but they contain the structure of the site and package everything together in a standard format. If the files are in a WAR, they are just unpacked by the server at deploy time anyway, there isnt any performance gain except the fact that it is easier to deploy.

You could just put the items in a sub directory if you really wanted.

like image 23
Davos555 Avatar answered Dec 20 '22 12:12

Davos555