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_1directory created by the extraction process.Set the
JAVA_HOMEandJBOSS_HOMEenvironment 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.0Unix: $ export JAVA_HOME=/usr/local/jdk1.4.2 $ export JBOSS_HOME=/usr/local/jboss-4.0Add
antto your execution path. Ant is the build utility.Windows: C:\workbook\ex13_1> set PATH=..\ant\bin;%PATH%Unix: $ export PATH=../ant/bin:$PATHThe 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.jarcopied to the JBossdeploydirectory 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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access