Running the example

To do a complete and clean run of this example, you will have to first start the EJB server and then run the two Java clients. Finally, at the end of the execution you might want to stop the EJB server. Here is how to proceed:

  1. Start the EJB server:

    • Unix platforms open a new terminal and proceed as follows:

      bash> cd $JONAS_ROOT/example/src/eb
      bash> EJBServer

    • Windows platforms open a new console window and proceed as follows:

      C:> cd %JONAS_ROOT%/example/src/eb
      C:> EJBServer

    JOnAS should display something like this:

    JOnAS Server, version 2.4.3, running on RMI.
    EJB container : AccountExpl available
    EJB container : AccountImpl available
    Done

  2. Start the two Java Clients:

    • Unix platforms open a new terminal and proceed as follows:

      bash> cd $JONAS_ROOT/example/src/eb
      bash> . $JONAS_ROOT/config/bin/unix/config_env
      bash> java eb.ClientAccount AccountImplHome
      bash> java eb.ClientAccount AccountExplHome

    • Windows platforms open a new console window and proceed as follows:

      C:> cd %JONAS_ROOT%/example/src/eb
      C:> config_env
      C:> java eb.ClientAccount AccountImplHome
      C:> java eb.ClientAccount AccountExplHome

    A successful run should output:

    Getting a UserTransaction object from JNDI
    Connecting to the AccountHome
    Getting the list of existing accounts in database
    101 Antoine de St Exupery 200.0
    102 alexandre dumas fils 400.0
    103 conan doyle 500.0
    104 alfred de musset 100.0
    105 phileas lebegue 350.0
    106 alphonse de lamartine 650.0
    Creating a new Account in database
    Finding an Account by its number in database
    Starting a first transaction, that will be committed
    Starting a second transaction, that will be rolled back
    Getting the new list of accounts in database
    101 Antoine de St Exupery 200.0
    102 alexandre dumas fils 300.0
    103 conan doyle 500.0
    104 alfred de musset 100.0
    105 phileas lebegue 350.0
    106 alphonse de lamartine 650.0
    109 John Smith 100.0
    Removing Account previously created in database
    ClientAccount terminated

  3. Stop the EJB server with the following command:

    JonasAdmin -s