J2EE application clients are like regular Java™ applications.
They contain a main() method that is executed,
and they continue executing until the client virtual machine terminates. They
can be run as typical "fat client" applications, to display a GUI that connects
to a set of EJBs for persistence and business logic, or as server applications
that provide services over the network. However, a J2EE application client
has several advantages over regular Java applications, because it runs within
a lightweight server container. This container can provide the application
client with services that used to be available only to other J2EE components.
Prerequisite: Create an EAR that contains a complete application
client project.
Benefits of using J2EE application clients instead of regular Java applications
include:
- Ability to run inside a server container, providing richer APIs.
- Use of J2EE security, including authentication and server-specific functions,
that might include features such as single-sign-on.
- Guaranteed Java 2 platform APIs available, as well as container
extensions.
- Simple JNDI lookup, because initial context properties are picked up from
the container.
- Packaged like other J2EE components, providing portability, easy deployment,
and clean packaging. This also supports the J2EE notion of a deployer being
able to modify the deployment information in order to move to a different
server without changing code.
- Use of the java:comp namespace to indirectly
reference EJBs.
To build a full command line to launch an application client, do the
following:
- Switch to the Debug perspective ().
- In the main toolbar, click the Run icon
and
select Run, alternatively click the Debug icon
and select Debug.
- In the Launch Configurations pane, select the type of configuration
that you want to create, either WebSphere® v5, v5.1, or v6.0 Application
Client and click New.
- In the Name field, enter the name of your
configuration.
- In the Application tab, select an Enterprise Application from the
Enterprise Application list.
If selected, the Profile process
(non-debug mode only) check box allows you to use the profiling tools provided
in the workbench to analyze the performance of your client application. You
cannot use profiling when the server is started in debug mode. For more information
on profiling an application, refer to the Application profiling documentation.
If
you want to make changes to your code while you are debugging, select the Enable
hot method replace in debug mode check box.
- In the Arguments tab, you can add Program arguments and VM arguments
as well as specifying your working directory. All WebSphere Application
Server client launcher arguments begin with -CC.
The default Program argument is -CCverbose=true,
which will provide useful debugging information and at run-time. Any arguments
that do not start with -cc will be passed to
your application at run-time. For more information on the various Program
arguments and VM arguments, refer to the WebSphere Application Server documentation
for the Launch Client tool
- When you have completed configuring your launch configurations,
click Apply to set your configuration, then click
Run to launch the application client.
Note: You may get an org.omg.CORBA.COMM_FAILURE when trying to access
a WebSphere v5.x
test environment from a J2EE client running on a remote machine. You have
to configure the ORB bootstrap host name defined in the remote server configuration
to fix the problem. To edit the ORB bootstrap host name, go to the Ports page
of the server editor. In the ORB bootstrap port section, type the remote host
name in the Host name field. Save the editor and restart
the test environment.