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 EJB and Web containers are provided by installing the Application Server component.
The Client container is provided by installing the WebSphere Application Client, typically on a machine that does NOT have the Application Server.
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).
From the Project Explorer, select Application Client Projects > Chapter2Client, and from the action bar select Run > Run....
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:
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.
Click Apply (in the lower right of the pop-up) to save the changes.
Click Run to execute the Application Client.
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.
Create an EJB project and add it to a new EAR project.
Create or import an enterprise bean into your EJB project.
Deploy your enterprise bean. To do this right-click on the EJB project and select Deploy.
To use the Universal Test Client:
Create a WebSphere server.
Add the EJB project to the server.
To ensure that the server is enabled to use the Universal Test Client:
In the Servers view, double-click your server. The server editor opens.
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.
Select the Enable universal test client check box.
Close the editor and save your changes.
Start a server.
To start the Universal Test Client:
In the Navigator view, right-click on an enterprise bean resource or an independent or stand-alone Java class.
Select Run > Run on Server. The Universal Test Client opens in the Web Browser.
Use the Universal Test Client to perform one or more of the following tasks:
Finding an enterprise bean or class
Calling a method
Removing an enterprise bean or class
Filtering the methods displayed
Editing the JNDI property settings
When you have finished using the Universal Test Client, close it.