Test and debug EJBs

Test the application client

J2EE application clients require a configured runtime environment called the Client container. This is similar to the Web container used for Servlets and JSPs and the EJB container used for EJBs. With WAS V6.0 the following applies:

The Application Server component also installs the Client container for the rare situation where you want to run an Application Client on the same system as your server (where the client is in one JVM and the server is in another JVM).

  1. From the Project Explorer, select Application Client Projects > Chapter2Client, and from the action bar select Run > Run....

  2. At the Create, manage, and run configurations pop-up perform the following actions:

    On the left, under Configurations, select WebSphere v6.0 Application Client, and select New.

    On the resulting right pane of the Application tab, complete the following fields:

    • Name: Chapter2Client

    • WebSphere Runtime: WebSphere Application Server V6.0

    • Enterprise application: Chapter2EAR

    • Application client module: Chapter2Client

    • Select Enable application client to connect to a server.

    • Select Use specific server, and then select 000-257 server.

    Run

  3. Click Apply (in the lower right of the pop-up) to save the changes.

  4. Click Run to execute the Application Client.

  5. At the Console view, verify that the Application Client completed successfully:

    WSCL0035I: Initialization of the J2EE Application Client Environment has completed.
    WSCL0014I: Invoking the Application Client class Main
    Hello, Mikalai !
    								

NOTE: before running publish application and then restart the server.

Testing enterprise beans in the universal test client

The server tools provide you with a Web-based Universal Test Client (UTC) where you can test your enterprise beans and Java classes.

Prerequisites:

To use the Universal Test Client:

  1. Create a WebSphere server.

  2. Add the EJB project to the server.

  3. To ensure that the server is enabled to use the Universal Test Client:

    1. In the Servers view, double-click your server. The server editor opens.

    2. For WebSphere Application Server v6.0: In the Servers view, double-click the WebSphere Application Server v6.0. Select the Overview tab and expand the Server section.

    3. Select the Enable universal test client check box.

      UTC enable

    4. Close the editor and save your changes.

  4. Start a server.

  5. To start the Universal Test Client:

    1. In the Navigator view, right-click on an enterprise bean resource or an independent or stand-alone Java class.

    2. Select Run > Run on Server. The Universal Test Client opens in the Web Browser.

  6. Use the Universal Test Client to perform one or more of the following tasks:

    • Finding an enterprise bean or class

      Create session bean in UTC

    • Calling a method

      Calling a method in UTC - 1

      Calling a method in UTC - 2

    • Removing an enterprise bean or class

    • Viewing fields

    • Filtering the methods displayed

      Filtering in UTC

    • Editing the JNDI property settings

      JNDI editing in UTC

  7. When you have finished using the Universal Test Client, close it.

BOOT.BY - Tech Industry News         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     Free SCWCD 1.4 Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free SCBCD 5.0 Study Guide