Benefits over using an EAR vs. WAR?
ear, jakarta-ee, java, war, wildfly
Solution
- Easier to deploy (only one package instead of multiples).
- Some server (example Weblogic, but not wildfly) allow shared session for an entire EAR.
- In general, EAR provide more option to configure with AS.
- Special folder (APP-INF) that let you define a config file `application.xml`.
If your application would consist only of multiple WARs then you may not find it such a big deal to maintain multiple deploy. However, consider an application which use WARs, EJBs, JMS etc. It will be a lot easier to mananage the interaction between all these components in an EAR.
You might want to read the packaging application part of the Java EE tutorial.
Problem
We're deploying our JavaEE 7 application on Wildfly 8. Previously, we've packaged all of our enterprise applications (WAR, multiple EJB JAR files) as an EAR. However, with JavaEE now allowing you to package EJBs in a WAR file (or as a JAR within the WAR's WEB-INF/lib) we're wondering if there is any benefit in deploying an EAR rather than going with WAR packaging. Does an EAR provide something that a WAR does not? It certainly reduces packaging complexity to make use of a WAR. Is there any difference in terms of deployment? EJB naming? Anything?