69

An answer to a question I read today suggested deploying an application as an exploded (unzipped) WAR. It got me thinking.

Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EAR file. At least as far as I can remember.

Have I been making a mistake all these years?

Are there advantages to deploying an app in its expanded form rather than packaged up?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Kevin D
  • 3,564
  • 1
  • 21
  • 38

6 Answers6

66

I think that was my answer mentioning the exploded WAR in the other question. Exploded WARs are easier to navigate and you can deploy 'parts' of your application that much quicker (depending on how our Web/App server deals with this), e.g. Replace a single resource like a JSP page. However it can have some drawbacks:

  1. Versioning - What version are you really running? "Hmmm, I'm not really sure now"

  2. Security - Do you have the right permissioning in place for the exploded format?

  3. Messiness - Files galore spread out all over your nice app/web server (some people really hate this).

Bottom line: I tend to go exploded for prototype Dev work and then move to proper packaging the closer to PRD I get.

StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25
Martijn Verburg
  • 3,287
  • 21
  • 26
  • It quite possibly was, it was certainly in relation to hotdeployment... permgen issues maybe. I've no trouble finding and replacing files when they have been exploded by the server, but I've certainly ran into scenario 1 many times :) – Kevin D Oct 11 '10 at 14:14
  • 2
    Could you explain why you prefer exploded WARs for development and packaged WARs for production? I'm just curios, because another answer recommends the opposite. – Christian Strempfer Feb 06 '11 at 17:38
  • 3
    For Security/reliability, I know that with a packaged and signed WAR that the app has not been altered/tampered with. – Martijn Verburg Feb 07 '11 at 15:52
20

The only real benefit you receive from deploying an exploded ear/war is the ability to hot-swap files on the server, as well as the time saved on the packaging (which IMHO is negligible).

Basically - this is a useful feature for development phases. I wouldn't choose this deployment method for a production environment.

There are also some web application servers which require exploded wars for some esoteric features, but this is nothing I've encountered in regular usage.

Yuval Adam
  • 161,610
  • 92
  • 305
  • 395
8

At the development stage, it's more comfortable to deploy it exploded. This way, you can hot update some deployed resources (as can be the JSP pages).

For Testing and Production environments, I prefer instead the packaged deployment: lighter, and easier to handle for the deployers.

Pang
  • 9,564
  • 146
  • 81
  • 122
Tomas Narros
  • 13,390
  • 2
  • 40
  • 56
5

Con: if you are on windows, you will often find that the OS randomly locks some file in the exploded .war, and it will be hard for you to delete the entire war and redeploy.

Luca Molteni
  • 5,230
  • 5
  • 34
  • 42
4

Not exploding a WAR/EAR when deploying does not make any difference to the Application Server. This is because underneath, they are all exploded.

For example, if you put a WAR file under webapp of tomcat, you will see that under your work directory, your WAR file will be exploded there.

Basically, WAR/EAR are just archiving your files so that it will be easier to move around and deploy

mezzie
  • 1,276
  • 8
  • 14
  • Thats pretty much what I thought Mezzie. Always open to the possibility that I've been wrong though. – Kevin D Oct 11 '10 at 14:12
  • Not always exploded. A web container may navigate the contents without unzipping. Many do “explode”/unzip by default, but not necessarily. – Basil Bourque Dec 15 '18 at 19:29
3

AFAIK, hot deployment is possible only with exploded wars. And also during development it is easier to browse the project tree on the server. Of course there can be other advantages and disadvantages, which I will be glad to hear.

Petar Minchev
  • 46,889
  • 11
  • 103
  • 119