0 Replies Latest reply on Aug 22, 2002 10:13 AM by romalley

    Simple Instructions for nesting Web Applications

    romalley

      Manoj,

      Each unique Web Application should be put in a WAR file. You have to decide what is a unique web application. If you have a web site -- call it http://site then app1 would be http://site/app1 and app2 would be http://site/app2.

      Optionally, each WAR file can be nested within an EAR file. So, if you had a common set of libraries that both app1 and app2 used, you could nest them:

        /ourEnterprise.ear
          /app1.war
          /app2.war

      If you don't want to nest your WAR files in an EAR file -- JBoss and other App Servers could deploy them separately but the EAR file provides another layer of 'containment' where you could have a version 1 deployment in ear1 and a version 2 deployment in ear2 even if both versions contain classes with the same names but different functionality (you have to scope the ear files in different classpath scopes to do this --I haven't tried that yet).

      Now, these things don't have to physically be archive (zip) files. They can be folders and still work fine. In development, I like to leave them simply folders of files and then optionally when deploying to production make them into archives.

      To leave them folders of files, when using JBoss you have to have the '.ear' and '.war' extensions in the foldername because JBoss seems to use the extension to know what kind of deployment it is.

      So, to leave them as folders and files, just follow the conventions for nesting certain required subfolders and files. The only rule is that all EAR folders must contain a META-INF folder (spelled that way) and the META-INF folder must contain an application.xml file (find an example of this file -- it's short -- just lists the modules in your EAR. All WAR folders must contain a WEB-INF folder (spelled that way) and the WEB-INF folder must have a file called web.xml -- usually short -- lists the servlet mappings and error pages. Find an example and copy it.

      So, when you are done, you will have:

        /ourEnterprise.ear
          /META-INF
            application.xml
          /app1.war
           /WEB-INF
              web.xml
            firstPage.jsp
            secondPage.jsp
          /app2.war
            /WEB-INF
              web.xml
            firstPage.jsp
            secondPage.jsp

      Placing the ourEnterprise.ear folder into a directory that is scanned by JBOSS for deployment will cause it to be picked up and activated.

      Now, if you want you can use a jar command or an ant directive to crate actual physical files from the above. There would be two WAR files and they would be nested within one EAR file. That EAR file is all that would be "sent to production" for deployment. The ant directive may even move things around and even create the application.xml and web.xml files but you would of course have to supply the information for them yourself.

      Bob O'Malley

      -----Original Message-----
      From: Manoj Kithany [mailto:MKITHANY@utah.gov]
      Sent: Wednesday, August 21, 2002 5:46 PM
      To: romalley@mindleaders.com
      Subject: WAR/EAR Files .... (REF - JBOSS Forum)


      Hi Bob,

      Greetings!

      I got your contact from the JBOSS Forum. I have some questions regarding the WAR/EAR Files? Do you know how to create these files. Do these need to be created for every application or only once...? Any relevant information on this would be appreciated.

      Thanks!

      Manoj G. Kithany