Chapter 30. Exercises for Chapter 13
Exercise 13.1: EJB Timer Service
In this exercise, you will learn how to use work with the EJB Timer Service. The examples in this chapter match the modifications made to the Ship EJB to enable Timers. This exercise builds off the code within Exercise 12.1, so initialization and deployment should be around the same.
Clean the Database
You need to clean and refresh the database. To do this, shutdown
JBoss if you have it running and run ant
clean.db
. Then restart JBoss.
Build and Deploy Example Programs
Perform the following steps:
Open a command prompt or shell terminal and change to the
ex13_1
directory created by the extraction process.Set the
JAVA_HOME
andJBOSS_HOME
environment variables to point to where your JDK and JBoss 4.0 are installed. Examples:Windows: C:\workbook\ex13_1> set JAVA_HOME=C:\jdk1.4.2 C:\workbook\ex13_1> set JBOSS_HOME=C:\jboss-4.0
Unix: $ export JAVA_HOME=/usr/local/jdk1.4.2 $ export JBOSS_HOME=/usr/local/jboss-4.0
Add
ant
to your execution path. Ant is the build utility.Windows: C:\workbook\ex13_1> set PATH=..\ant\bin;%PATH%
Unix: $ export PATH=../ant/bin:$PATH
The exercise uses a JMS Topic. Deploy the topic using the following Ant target.
$ ant make-topic
Build the EJBs used in this example.
$ ant
You will see
titan.jar
copied to the JBossdeploy
directory and redeployed by the application server.Initialize the database.You will see a bunch of entity beans being created.
$ ant createdb
Examine the Service Code
The scheduleMaintenance, ...
Get Enterprise JavaBeans, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.