Previous  Table of Contents  Next

  J2EE Tools - Lightweight IDE for J2EE Version 1.4  
     
 

GETTING STARTED

Build, Deploy and Run Savings Account Enterprise Application

This page describes how to build, deploy and run the Savings Account enterprise application in the J2EE Tutorial.
  1. Browse Savings Account Enterprise Application in J2EE Tutorial:

    1. Click Help | J2EE Tutorial in the J2EE Tools window.
    2. Wait until the J2EE Tutorial appears in the browser window.
    3. Scroll to Chapter 26: Bean-Managed Persistence Examples then click The Savings Account Bean Example.
    4. When done browsing, click X in the top right corner of the browser window.
  2. Build Savings Account Enterprise Application:

    1. Click the Application tab in the J2EE Tools window.
    2. Click the Project Directory box in the Application tab then click ejb in the popup list.
    3. Click the Application Directory box then click savingsaccount.
    4. Click the Build File box then click build.xml (default).
    5. Click the Build Target box then click build (default).
    6. Click Tools | Build.
    7. Wait until Build Successful appears in the Build Target window.
    8. Click X in the top right corner of the Build Target window.
  3. Start Database Server:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Tools | Database Server | Start in the J2EE Tools window.
      2. Wait until Server started appears in the Database Server window.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database Server | Start in the J2EE Tools window.
      2. Wait until Command start-database executed successfully appears in the Start Database Server window.
      3. Click X in the top right corner of the Start Database Server window.
  4. Create Savings Account Database Table:

    1. Click the Build Target box in the J2EE Tools window then click create-db_common in the popup list.
    2. Click Tools | Build.
    3. Wait until Build Successful appears in the Build Target window.
    4. Click X in the top right corner of the Build Target window.
  5. Display Savings Account Database Table:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Tools | Database | Console in the J2EE Tools window.
      2. Wait until the Connect to Database dialog appears.
      3. Click the URL field in the Connect to Database dialog then type jdbc:pointbase:server://localhost:9092/sun-appserv-samples in the field.
      4. Click the Password field then type PBPUBLIC.
      5. Click OK.
      6. Wait until the PointBase Console window appears.
      7. Click the Enter SQL Commands area in the PointBase Console window then type select * from savingsaccount; in the area.
      8. Click Execute above the Enter SQL Commands area.
      9. Verify that the Savings Account table contains 0 rows.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database | Command Line Interface in the J2EE Tools window.
      2. Wait until the Database Command Line Interface window appears.
      3. Click the Enter field in the Database Command Line Interface window then type select * from savingsaccount; and press the Enter key.
      4. Verify that the Savings Account table contains 0 rows.
  6. Start Application Server:

    1. Click Tools | Application Server | Start in the J2EE Tools window.
    2. Wait until Application server startup complete appears in the Start Application Server window.
    3. If the domain window appears, click _ (minimize) in the top right corner of the domain window.
  7. Create EJB Tutorial JDBC Resource on Application Server:

    1. Click the Build Target box in the J2EE Tools window then click create-jdbc-resource_common in the popup list.
    2. Click Tools | Build.
    3. Wait until Command create-jdbc-resource executed successfully appears in the Build Target window followed by Build Successful.
    4. Click X in the top right corner of the Build Target window.
  8. Create Savings Account Enterprise Application Enterprise Archive File:

    1. Click Tools | Deployment | Console in the J2EE Tools window.
    2. Wait until the Deployment Tool window appears.
    3. Click File | New | Application in the Deployment Tools window.
    4. Click Browse in the New Application dialog.
    5. Click Up One Level in the New Application dialog until Local Disk (C:) appears in the Look In box.
    6. Double click the fieldbird directory in the Look In area.
    7. Double click the j2eetools directory in the Look In area.
    8. Double click the j2ee directory in the Look In area.
    9. Double click the projects directory in the j2ee directory.
    10. Double click the ejb directory in the projects directory.
    11. Double click the savingsaccount directory in the ejb directory.
    12. Click the File Name field then type SavingsAccountApp.ear.
    13. Click New Application.
    14. Verify that the Application File Name field in the New Application dialog contains C:\fieldbird\j2eetools\j2ee\projects\ejb\savingsaccount\SavingsAccountApp.ear.
    15. Click OK.
  9. Create Savings Account Enterprise Application Enterprise Java Bean in Enterprise Archive File:

    1. Click File | New | Enterprise Bean in the Deployment Tool window.
    2. Click Next in the New Enterprise Bean Wizard - Introduction dialog.
    3. Click Create New JAR Module in Application in the New Enterprise Bean Wizard - EJB JAR General Settings dialog.
    4. Click the Create New JAR Module in Application box then click SavingsAccountApp.
    5. Click the JAR Name field then type SavingsAccountJAR.
    6. Click Edit Contents.
    7. Verify that the Starting Directory box in the Edit Contents dialog contains C:\fieldbird\j2eetools\j2ee\projects\ejb\savingsaccount.
    8. Double click the build directory in the Available Files area.
    9. Click the InsufficientBalanceException.class file in the build directory then click Add.
    10. Click the SavingsAccount.class file in the build directory then click Add.
    11. Click the SavingsAccountBean.class file in the build directory then click Add.
    12. Click the SavingsAccountHome.class file in the build directory then click Add.
    13. Click OK.
    14. Click Next in the New Enterprise Bean Wizard - EJB JAR General Settings dialog.
    15. Click the Enterprise Bean Class box in the New Enterprise Bean Wizard - Bean General Settings dialog then click SavingsAccountBean in the popup list.
    16. Click the Enterprise Bean Name field then type SavingsAccountBean.
    17. Click the Enterprise Bean Type box then click Entity.
    18. Click the Remote Home Interface box then click SavingsAccountHome.
    19. Click the Remote Interface box then click SavingsAccount.
    20. Click Next.
    21. Click the Persistence Management Type box in the New Enterprise Bean Wizard - Entity Bean Settings dialog then click Bean-Managed Persistence in the popup list.
    22. Click Unknown Primary Key Class.
    23. Click Next.
    24. Click Finish in the New Enterprise Bean Wizard - Next Steps dialog.
    25. Click SavingsAccountBean under SavingsAccountJAR on the left side of the Deployment Tool window.
    26. Click the Resource Refs tab on the right side of the Deployment Tool window.
    27. Click Add in the Resource Refs tab.
    28. Click the field under Coded Name then type jdbc/SavingsAccountDB.
    29. Click the field under Type then click javax.sql.DataSource.
    30. Click the field under Authentication then click Container.
    31. Verify that the field under Shareable is checked.
    32. Click the JNDI Name box then type jdbc/ejbTutorialDB.
  10. Create Savings Account Enterprise Application Client in Enterprise Archive File:

    1. Click File | New | Application Client in the Deployment Tool window.
    2. Click Next in the New Application Client Wizard - Introduction dialog.
    3. Click Create New AppClient Module in Application in the New Application Client Wizard - JAR File Contents dialog.
    4. Click the Create New AppClient Module in Application box then click SavingsAccountApp.
    5. Click the AppClient Name field then type SavingsAccountClient.
    6. Click Edit Contents.
    7. Verify that the Starting Directory box in the Edit Contents dialog contains C:\fieldbird\j2eetools\j2ee\projects\ejb\savingsaccount.
    8. Double click the build directory in the Available Files area.
    9. Click the SavingsAccountClient.class file in the build directory then click Add.
    10. Click OK.
    11. Click Next in the New Application Client Wizard - JAR File Contents dialog.
    12. Click the Main Class box in the New Application Client Wizard - General dialog then click SavingsAccountClient in the popup list.
    13. Click Next.
    14. Click Finish in the New Application Client Wizard - Next Steps dialog.
    15. Click SavingsAccountClient under SavingsAccountApp on the left side of the Deployment Tool window.
    16. Click the EJB Refs tab on the right side of the Deployment Tool window.
    17. Click Add in the EJB Refs tab.
    18. Click the Coded Name field in the Add Enterprise Bean Reference dialog then type ejb/SimpleSavingsAccount in the field.
    19. Click the EJB Type box then click Entity.
    20. Click the Interfaces box then click Remote.
    21. Click the Home Interface box then type SavingsAccountHome.
    22. Click the Local/Remote Interface box then type SavingsAccount.
    23. Click JNDI Name.
    24. Click the JNDI Name box then click SavingsAccountBean.
    25. Click OK.
    26. Click File | Save in the Deployment Tool window.
    27. Click File | Exit.
  11. Deploy Savings Account Enterprise Application Enterprise Archive File on Application Server:

    1. Click Tools | Deployment | Deploy in the J2EE Tools window.
    2. Wait until Command deploy executed successfully appears in the Deploy Archive File window.
    3. Click X in the top right corner of the Deploy Archive File window.
  12. Run Savings Account Enterprise Application Client:

    1. Click Tools | Run | Application Client in the J2EE Tools window.
    2. Wait until the following output appears in the Run Application Client window:
      balance = 68.25 (Duke's balance)
      balance = 32.55 (Joe's balance)
      456: 44.77 (Pat's id and balance)
      730: 19.54 (John's id and balance)
      268: 100.07 (Mary's id and balance)
      836: 32.55 (Joe's id and balance)
      456: 44.77 (Pat's id and balance)
      4 (Pete's balance)
      7 (Sally's balance)
    3. Click X in the top right corner of the Run Application Client window.
  13. Undeploy Savings Account Enterprise Application Enterprise Archive File on Application Server:

    1. Click Tools | Deployment | Undeploy in the J2EE Tools window.
    2. Wait until Command undeploy executed successfully appears in the Undeploy Archive File window.
    3. Click X in the top right corner of the Undeploy Archive File window.
  14. Stop Application Server:

    1. Click Tools | Application Server | Stop in the J2EE Tools window.
    2. Wait until JMS service shutdown complete appears in the Start Application Server window.
    3. Click X in the top right corner of the Start Application Server window.
    4. Click X in the top right corner of the Stop Application Server window.
  15. Display Savings Account Database Table:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click Execute above the Enter SQL Commands area in the PointBase Console window.
      2. Verify that the savingsaccount table now contains 6 rows.
      3. Click X in the top right corner of the PointBase Console window.
      4. Click Yes in the Console Exit dialog.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click the Enter field in the Database Command Line Interface window then press the Up Arrow key.
      2. Verify that select * from savingsaccount; appears in the Enter field and press the Enter key.
      3. Verify that the savingsaccount table now contains 6 rows.
      4. Click the Enter field then type exit; and press the Enter key.
      5. Click X in the top right corner of the Database Command Line Interface window.
  16. Stop Database Server:

    1. If you're using the PointBase database in SJSAS Edition 8.0:

      1. Click the Enter field in the Database Server window then type x in the field and press the Enter key.
      2. Wait until PointBase Server Stopped appears in the Database Server window.
      3. Click X in the top right corner of the Database Server window.
    2. If you're using the Derby database in SJSAS Edition 8.2:

      1. Click Tools | Database Server | Stop in the J2EE Tools window.
      2. Wait until Command stop-database executed successfully appears in the Stop Database Server window.
      3. Click the X in the top right corner of the Stop Database Server window.
 

 
Get J2EE Tools from Field Bird at SourceForge.net Previous  Table of Contents  Next