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.
Before you begin
- Create an EAR that contains a complete application client project.
About this task
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,
complete the following steps:
Procedure
- Switch to the Debug perspective ().
- In the main toolbar, expand the Run icon and select Run Configurations, alternatively
expand the Debug icon and select Debug Configurations.
- In the left pane of the dialog box, select WebSphere
Application Server vx.x Application Client, where x.x is the version level of the WebSphere® Application Server
and click New launch configuration.
- In the Name field, enter the name
of your configuration.
- In the Application tab, select your enterprise application
from the Enterprise Application list.
- For WebSphere Application Server v6.0, if you want to make changes to your code
while you are debugging, select the Enable hot method replace
in debug mode check box.
Tip: Hot
method replace is only an option on WebSphere Application Server v6.0. In later
versions, it is enabled in debug mode by default.
- 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.