Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benefits over using an EAR vs. WAR?

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?

like image 428
Shadowman Avatar asked Feb 20 '15 17:02

Shadowman


1 Answers

  • 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.

like image 194
Jean-François Savard Avatar answered Sep 20 '22 21:09

Jean-François Savard