war archive has many benefits, but also makes it impossible to exchange single application components independently.
E.g., you have some web application, that retrieves data via RESTful web services on the same server:
The standard packaging would be:
webapp.war |-- ui.html |-- META-INF `-- WEB-INF `-- lib `-- webservices.ejb
which will work.
But what if you want to keep the web UI separate from the
ejb module? There are different szenarios:
war indepentently from each other:
which will not work.
You could also think of packaging the
ejb module inside an
app.ear `-- webservices.ejb webapp.war
which will also not work.
The problem here is always the same, the
ejb module cannot be deployed without a web module, which will provide the necessary web content for the web services.
What is possible, nevertheless, is to package the
ejb into another
war archive, that contains just the
ejb module but no other web content:
webapp.war |-- ui.html |-- META-INF `-- WEB-INF webservices.war |-- META-INF `-- WEB-INF `-- lib `-- webservices.ejb
This way, model, view and controller can be kept separate. The trick is to package the
ejb inside another
war, which will provide the necessary web content.