The Java EE 6 Tutorial, Volume I

Building, Packaging, Deploying, and Running the timersession Example

You can build, package, deploy, and run the timersession example using either NetBeans IDE or Ant.

ProcedureBuilding, Packaging, Deploying, and Running the timersession Example Using NetBeans IDE

Follow these instructions to build, package, and deploy the timersession example to your Enterprise Server instance using the NetBeans IDE IDE.

  1. In NetBeans IDE, select File->Open Project.

  2. In the Open Project dialog, navigate to tut-install/examples/ejb/.

  3. Select the timersession folder.

  4. Select the Open as Main Project check box.

  5. Click Open Project Folder.

  6. Select Run->Run Main Project.

    This builds and packages the application into timersession.war, located in tut-install/examples/ejb/timersession/dist/, deploys this WAR file to your Enterprise Server instance, and then runs the web client.

ProcedureBuilding, Packaging, and Deploying the timersession Example Using Ant

Follow these instructions to build, package, and deploy the timersession example to your Application Server instance using Ant.

  1. In a terminal window, go to the tut-install/examples/ejb/timersession/ directory.

  2. To build timersession, type the following command:


    ant build
    

    This runs the default task, which compiles the source files and packages the application into a WAR file located at tut-install/examples/ejb/timersession/dist/timersession.war.

  3. To deploy the application, type the following command:


    ant deploy
    

ProcedureRunning the Web Client

  1. Open a web browser to http://localhost:8080/timersession.

  2. Click the Set Timer button to set a programmatic timer.

  3. Wait for a while and click the browser's Refresh button.

    You will see the date and time of the last programmatic and automatic timeouts.

    You can also see the messages that are logged when a timeout occurs by opening the server.log file located in domain-dir/server/logs/.