The Java EE 5 Tutorial

Building, Packaging, Deploying, and Running the timersession Example

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

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

    Follow these instructions to build, package, and deploy the timersession example to your Application 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/javaeetutorial5/examples/ejb/.

  3. Select the timersession folder.

  4. Select the Open as Main Project and Open Required Projects check boxes.

  5. Click Open Project.

  6. Select Run->Run Main Project.

This builds and packages the application into timersession.ear, located in tut-install/javaeetutorial5/examples/ejb/timersession/dist/, deploys this EAR file to your Application Server instance, and then runs the application client.

You will see the output from the application client in the Output tab:


...
Creating a timer with an interval duration of 3000 ms.
run-timersession-app-client:
run-nb:
BUILD SUCCESSFUL (total time: 16 seconds)

    The output from the timer is sent to the server.log file located in the domain-dir/server/logs/ directory. To view this file:

  1. Click the Services tab.

  2. Right-click your Application Server instance and select View Server Log.

Look for the following line at the bottom of server.log:


Timeout occurred

Building, 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/javaeetutorial5/examples/ejb/timersession/ directory.

  2. To build TimerSessionBean, type the following command:


    ant build
    

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

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


    ant deploy
    

Running the timersession Application Client Using Ant

    To run the application client, perform the following steps.

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

  2. Type the following command:


    ant run
    

    This task first retrieves the client JAR, timersessionClient.jar to the dist directory, and then runs the client. This is the equivalent of running:


    appclient -client TimerSessionAppClient.jar
    
  3. In the terminal window, the client displays these lines:


    Creating a timer with an interval duration of 30000 ms.

The output from the timer is sent to the server.log file located in the domain-dir/server/logs/ directory.

    View the output in the Admin Console:

  1. Open the Admin Console by opening the following URL in a web browser:


    http://localhost:4848/
  2. Enter the admin username and password to log in to the Admin Console.

  3. Click Application Server in the navigation pane.

  4. Click View Log Files.

  5. At the top of the page, you’ll see this line in the Message column:


    Timeout occurred

Alternatively, you can look at the log file directly. After about 30 seconds, open server.log in a text editor and you will see the following lines:


TimerSessionBean: Timeout occurred