7.2. Running the Examples

To run the samplemdb example, you will have to first start the JOnAS server and then run the Java client. Finally, at the end of the execution you should stop the JOnAS server.

NoteNote
 

$JONAS_ROOT/examples/src/mdb/samplemdb is assumed to be the current folder in the following example.

Here is how to proceed:

  1. As root, start the Red Hat Application Server server with the following command:

    /sbin/service jonas start
    jonas admin -a samplemdb.jar
  2. Start the Java Client:

    jclient samplemdb.MdbClient 

    A successful run should output something similar to:

    JMS client: tcf = TCF:localhost-16010
    JMS client: tc = Cnx:#0.0.1030-21
    MDBsample is OK
  3. As root, stop the Red Hat Application Server server:

    /sbin/service jonas stop

NoteNote
 

The jar can also be deployed using the web interface. The steps are similar to those described in Section 2.2.2 Quick Start to the SB Example, but using the file samplemdb.jar.

To run the sampleappli example, you will have to first start the JOnAS server and then run the Java client. Finally, at the end of the execution you should stop the JOnAS server.

NoteNote
 

$JONAS_ROOT/examples/src/mdb/sampleappli is assumed to be current folder in the following example.

Here is how to proceed:

  1. As root, start the Red Hat Application Server server with the following command:

    /sbin/service jonas start
    jonas admin -a sampleappli.jar
  2. Start the Java Client:

    jclient sampleappli.SampleAppliClient

    A successful run should output something similar to:

    For CustomerId = customer1 ProductId= 00001 Quantity= 5
    For CustomerId = customer10 ProductId= 00003 Quantity= 3
    For CustomerId = customer3 ProductId= 00002 Quantity= 2
    For CustomerId = customer2 ProductId= 00004 Quantity= 6
    For CustomerId = customer3 ProductId= 00001 Quantity= 10
    For CustomerId = customer1 ProductId= 00002 Quantity= 5
    For CustomerId = customer10 ProductId= 00004 Quantity= 3
    For CustomerId = customer2 ProductId= 00003 Quantity= 10
    For CustomerId = customer7 ProductId= 00002 Quantity= 2
    For CustomerId = customer45 ProductId= 00001 Quantity= 4
    For CustomerId = customer122 ProductId= 00003 Quantity= 6
    Nb messages sent and received OK
    StockId = 00000 Quantity = 10
    StockId = 00004 Quantity = 1
    StockId = 00001 Quantity = 1
    StockId = 00003 Quantity = 1
    StockId = 00002 Quantity = 1
    SampleApplicationClient   OK 
  3. As root, stop the Red Hat Application Server server:

    /sbin/service jonas stop

Each example comes with a corresponding README file.