Section 1.6. Deploying Applications to JBoss

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:

  • $JBOSS_HOME/lib is for the application server's dependent libraries. These file types should always be packaged as JARs. You should never put your own JARs in this directory.

  • $JBOSS_HOME/server/[server configuration]/lib is for the Server Configuration's dependent libraries. These, too, should always be JARs. You may add an occasional database driver JAR to this directory.

  • $JBOSS_HOME/server/[server configuration]/deploy is for SARs, WARs, and EARs. Plain old JARs will be ignored if placed here directly, although all three types of files may themselves contain JARs.

If you haven't done so already, go to 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.

JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: