You can build, package, deploy, and run the timersession example using either NetBeans IDE or Ant.
Follow these instructions to build, package, and deploy the timersession example to your Application Server instance using the NetBeans IDE IDE.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/ejb/.
Select the timersession folder.
Select the Open as Main Project and Open Required Projects check boxes.
Click Open Project.
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:
Click the Services tab.
Right-click your Application Server instance and select View Server Log.
Look for the following line at the bottom of server.log:
Timeout occurred |
Follow these instructions to build, package, and deploy the timersession example to your Application Server instance using Ant.
In a terminal window, go to the tut-install/javaeetutorial5/examples/ejb/timersession/ directory.
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.
To deploy the application, type the following command:
ant deploy |
To run the application client, perform the following steps.
In a terminal window, go to the tut-install/javaeetutorial5/examples/ejb/timersession/ directory.
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 |
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:
Open the Admin Console by opening the following URL in a web browser:
http://localhost:4848/ |
Enter the admin username and password to log in to the Admin Console.
Click Application Server in the navigation pane.
Click View Log Files.
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 |