2 Replies Latest reply on Dec 19, 2003 9:52 AM by juha

    Web application suite - single or multiple WAR?

      Designing a "suite" of web applications: single login can access features such as order entry, customer service, payroll, purchase orders, etc. EJB tier as well and some EJB functions may be shared across more than one feature.

      Trying to determine the best way to organize and deploy this suite of applications - huge single WAR or multiple WAR files.

      Advantage of individual WAR for each "feature" is independent deployment. For example, I can deploy a change to the payroll feature without knocking off the users of the customer service feature. Multiple WAR also allows to easily deploy features to clients as the client desires (ie: as they are licensed). For example oe.war, custservice.war, payroll.war, po.war.

      I also suspect smaller, multiple WAR files would aid in development and testing.

      The huge disadvantage of individual WARs is the lack of HttpSession sharing between WARs. Suddenly I have to architect a way around a J2EE spec that hinders rather than helps in this specific case. The single login is only the first thing I need a shared session for right now, but, I am sure there will be many other needs down the road that a shared session object would be useful for.

      I believe any change to the shared EJB tier would require me to "touch" each WAR file that used that code reagrdless of single or multiple war files. SO that only plays into the decision that from a managemnet standpoint a single WAR is easier to keep track of for this purpose.

      What is everyone else doing? Any comments would be greatly appreciated.

      FYI - using JBoss 3.2.1 with Jetty at this time. If Tomcat offers a solution to this that Jetty does not, please let me know.

        • 1. Re: Web application suite - single or multiple WAR?

          Ok, I am thinking it is best to use multiple WAR files. I have some common code to all WARs (but is not an EJB), should I deploy the common code in a SAR file so that all WARs can access it on the classpath. That way, I don't have to deploy copies of the same common code in the /lib of each WAR?

          If so, I don't really have a service in the SAR, so do I need a jboss-service.xml in the SAR? Final question, should the multiple WAR files be deployed within the SAR or on their own? Is there an advantage/disadvantage to either way?

          • 2. Re: Web application suite - single or multiple WAR?

            You can deploy regular Java archives (JARs) as well, you don't need to create SAR archive just for your classes.

            There's a single classloader per top level package deployment so whether you deploy multiple packages or single package with many nested subpackages determines your redeployment granularity. Redeploy always replaces an entire classloader (and obviously all components within its scope, including subpackages).