Now that we have downloaded and installed both the JBoss Application Server and the Seam Framework, we can deploy one of the sample applications provided with Seam to ensure that we have got everything configured correctly.
To test our environment, we need to:
1. Start the JBoss Application Server
2. Deploy the sample application
3. Run the sample application
As we mentioned in the earlier section, starting the JBoss Application Server is a simple matter of either double-clicking on the run.bat
file or executing the run.sh
script. Startup the Application Server using the appropriate technique and ensure that there are no errors displayed within the console window.
Each of the Seam sample applications can be built using pre-supplied ant scripts. These scripts allow applications to be built and deployed from the command line.
Before building and deploying these sample applications, we need to edit the <seam_home>/build.properties
file to specify the location of the JBoss Application Server. We need to do this so that the compiled application can automatically be deployed to the application server. Edit this file and add a line that sets the jboss.home
property to the location of the application server, as shown (/Applications/jboss-5.0.0.GA) in the following example screenshot:
Now that we have started the application server and specified its location within the Seam example configuration files, we can build one of the sample applications to ensure that it runs correctly.
Open up a command prompt (or command shell) and navigate to the <seam_home>/examples/numberguess
directory. Within this directory, execute the ant deploy
task, which will build the Number Guess example application and deploy it to our running instance of the application server. In the case of the JBoss Application Server, deploying the sample application is simply a matter of the application's .ear
file being copied into the <jboss_home>/server/default/deploy
directory.
Assuming that no errors were displayed whilst deploying the application, we can open up a browser and point it to http://localhost:8080/seam-numberguess
to test the application, as shown in the following screenshot:
In addition to running the sample application, we can run the unit tests that are supplied with it by executing the ant test
command. The Seam Framework provides excellent support for unit testing applications, which we will discuss in detail in Chapter 5. For the moment though, execute the test
target command and note that several tests run successfully.