Site hosted by Angelfire.com: Build your free website today!

J2EE Applications - deploy as an EAR file or a War file?

There's a lot of overhead associated with deploying an EAR file if you aren't going to be taking advantage of distrisbuted remote object calls, so how do you know when to deploy an application as a .EAR (Enterprise Archive) file or a .WAR (Web Archive) file?

And if you don't need an EAR file, do you need an application server?

First off, the packaging/deploying of a .WAR file is much simpler than that of an .EAR file. A .WAR file doesn't need to have separate .JARS for EJBs, and it doesn't need an application.xml file specifying the the deployed modules or the context root of the application. The name of your .WAR file is the web context to you application - so:
fwrk-web.war = http://localhost:7001/fwrk-web/index.jsp

It still makes sense to use an application server when even if you're just deploying a .WAR file (with no EJBs) because it *should* be more stable and offer more options for future upgrades to your application. You will be able to define connection pools and datasources for your application and have the application server manage those deployed instances to you app.

Monitoring/Configuring an application on an application server is often easier than with a web server because it will be more robust because of many advanced features that application servers have to offer. It will be simpler to setup Datasources, Error Logging, Deploying/Undeploying, Webservices, JMS, and many other J2EE specific options.