Run a Java Application to Transfer Funds

You can also access enterprise beans from a Java client application, instead of a servlet. The TransferApplication uses the Transfer enterprise bean to show you how.

Reminders:

  • Before you can run any of the sample enterprise beans, you must deploy them. This sample requires you to deploy Account.jar and Transfer.jar.
  • As with the Transfer servlet, in order to transfer funds, the Transfer enterprise bean requires at least two Accounts: one to transfer to and one to transfer from. You must first use the Account enterprise bean sample to create these accounts.
  • The runTransferApp scripts (discussed below) assume that you installed the JDK along with the Application Server.

To run this application from the same system as the Application Server:

  1. From a system command prompt, go to <was_root>/hosts/default_host/WSsamples_app/servlets.


  2. For Windows NT, enter: runTransferApp
    For UNIX, enter: runTransferApp.sh

To run this application from a different system (call it the "remote system") than the Application Server

  1. In order to have all the necessary files on your remote system, you should install the Application Server on the remote system.
    • Do a Custom Installation, installing the samples and the JDK.
    • For the database repository, select any database other than InstantDB. You do not need the database you select to actually be present on your remote system.

  2. After the installation is completed, do not start up the Application Server. Remember, the only reason for the installation was to place the necessary files on your remote system.

  3. When you deployed Account.jar and Transfer.jar on your Application Server system, the two files DeployedAccount.jar and DeployedTransfer.jar were created on your Application Server system.

    • The two files DeployedAccount.jar and DeployedTransfer.jar are located in <was_root>/deployedEJBs on your Application Server system.
    • Copy the two files to the same <was_root>/deployedEJBs on your remote system.

  4. You will need to edit and recompile the ClientResourceBundle.java file on your remote system.

    • ClientResourceBundle.java is located in the AccountAndTransfer directory that is in turn located several directories beneath the <was_root>/hosts/default_host/WSsamples_app/servlets directory.
    • Towards the bottom of the file, "localhost" in the text "iiop://localhost:900" should be changed to point to your Application Server system.
    • You can recompile using the createbeans.bat or createbeans.sh scripts. Remember to copy the new ClientResourceBundle.class file over the old version of the file.

  5. From a system command prompt, go to <was_root>/hosts/default_host/WSsamples_app/servlets to run the Transfer Application:

    For Windows NT, enter: runTransferApp
    For UNIX, enter: runTransferApp.sh