I’ve recently run into a snag that will probably keep me from being able to follow through with plans to package a single WAR with two servlets. The work-around is to create an extra Maven WAR module.
Besides the extra hassle for me and for customers, is there any other real drawback? are there advantages?
@Edit
The “snag” I have run into is that I want two different authentication mechanisms for each servlet. One to use Spring Security and the other either a different authentication provider or possibly Basic authentication. See here:
The main drawback is that the web application container keeps the separate applications completely apart from each-other. So if they use a common set of jar files (for example), they will each have to load their own version, which takes up a lot of memory. Also, they cannot really communicate with each-other via Session or ServletContext, or request forwarding.
The advantage only comes from situations where you really think of the two WAR as independent applications.
If the two servlets belong together you should put them into the same WAR.