Advantages/Disadvantages to exploded WAR files

26,700

Solution 1

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.

Solution 2

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.

Solution 3

At the development stage is more confortable 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: ligther, and easier to handle for the deployers.

Solution 4

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.

Solution 5

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

Share:
26,700
Kevin D
Author by

Kevin D

I'm a developer. Primarily working in the Java ecosystem.

Updated on July 05, 2022

Comments

  • Kevin D
    Kevin D almost 2 years

    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?

  • Kevin D
    Kevin D over 13 years
    Thats pretty much what I thought Mezzie. Always open to the possibility that I've been wrong though.
  • Kevin D
    Kevin D over 13 years
    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 :)
  • Christian Strempfer
    Christian Strempfer about 13 years
    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.
  • Martijn Verburg
    Martijn Verburg about 13 years
    For Security/reliability, I know that with a packaged and signed WAR that the app has not been altered/tampered with.
  • Koray Tugay
    Koray Tugay almost 10 years
    Will hot swap work for listeners and servlets or only jsp files?
  • Yuval Adam
    Yuval Adam almost 10 years
    @KorayTugay that really depends on your severs capabilities
  • Basil Bourque
    Basil Bourque over 5 years
    Not always exploded. A web container may navigate the contents without unzipping. Many do “explode”/unzip by default, but not necessarily.