1.6. Deploying Applications to JBoss
J2EE applications are generally bundled up as Enterprise Archives (EARs) or Web Archives (WARs). JBoss services can be bundled up as Service Archives (SARs). While each application technically is nothing more than a simple Java Archive (JAR), they have special internal directory structures and configuration files that must be present for the sake of the application server. (We will discuss EARs and WARs in greater detail later in the book.)
Knowing when to use these different file types and where to place them can be confusing. Here are some basic principles:
If you haven't done so already, go to http://www.jbossatwork.com and download the code examples. Once you've unzipped the downloaded file, copy jaw.war from the ch01/ 01a-test directory to $JBOSS_HOME/server/default/deploy. In the JBoss console window, you should see the deployed test application.
To verify that the application was deployed correctly, open a web browser and go to http://localhost:8080/jaw (see Figure 1-2).
Figure 1-2. JAW Motors web page
Note that our WAR is treated no differently than an MBean. If you move jaw.war to the undeploy/ directory, JBoss will dynamically unload it, as it did with Hypersonic earlier.