Run the Servlet with JavaBean Example

When WebLogic Server is started in the default \config\mydomain directory, the EJBean example is automatically deployed in the \applications directory.

  1. Start the WebLogic Server in the \config\mydomain directory. You can check that the EJBean has been deployed correctly either by checking the server command-line window, or by opening the Console and examining EJB under Deployments. You must see ejb.jolt.bankapp deployed and must be able to monitor its activity.
  2. Open a separate command-line window, and then run the client by entering the following command:
    $ java examples.jolt.ejb.bankapp.Client

    If you are not running the WebLogic Server with its default settings, you will have to use the following command line:

    $ java examples.jolt.ejb.bankapp.Client "t3://WebLogicURL:Port"

    where the following parameters are defined as follows:

    • WebLogicURL—the domain address of the WebLogic Server
    • Port—the port listening for connections (weblogic.system.ListenPort)

    The following optional parameters are interpreted by the client in the order in which they are listed:

    • url—unique resource location of Server, such as t3://localhost:7001
    • user—username, default null
    • password—user password, default null
  3. If you are running the Client example, you must get output that is similar to the following from the client application:
4.Beginning jolt.bankapp.Client...
5.
6.Created teller Terry
7.
8.Getting current balance of Account 10000 for Erin
9.Balance: 27924.02
10.
11.Start Transaction 1 for Erin
12.
13. Depositing 100.0 for Erin
14. Balance: 28024.02
15.
16.End Transaction 1 for Erin
17.
18.Start Transaction 2 for Erin
19.
20. Depositing 200.0 for Erin
21. Balance: 28224.02
22.
23. Withdrawing 28324.02 for Erin
24. Transaction error:
25. examples.jolt.ejb.bankapp.TransactionErrorException: Teller error:
application
26. exception:
27.Account Overdraft
28.
29. Rolling back transaction for Erin
30.
31.End Transaction 2 for Erin
32.
33.Getting final balance of Account 10000 for Erin
34.Balance: 28024.02
35.
36.Removing teller Terry
37.
End jolt.bankapp.Client...

Note:

Note how the final balance shows that Transaction 2 was rolled back to the balance at the end of Transaction 1.

You can read more about EJBs in the Programming WebLogic Enterprise JavaBeans guide. To learn more about using Oracle Jolt, refer to the Using Oracle Jolt guide.