In your client code, reference the EJB component by using an @EJB annotation or by looking up the JNDI name as defined in the ejb-jar.xml file.
For more information about annotations in application clients, see section 9.4 of the Java EE 5 Specification.
For more information about naming and lookups, see Accessing the Naming Context.
If load balancing is enabled as in Step 7 and the EJB components being accessed are in a different cluster, the endpoint list must be included in the lookup, as follows:
Define the @EJB annotations or the ejb-ref elements in the application-client.xml file. Define the corresponding ejb-ref elements in the sun-application-client.xml file.
For more information on the application-client.xml file, see the Java EE 5 Specification, Section EE.9.7, “Java EE Application Client XML Schema.”
For more information on the sun-application-client.xml file, see The sun-application-client.xml file in Sun Java System Application Server 9.1 Application Deployment Guide. For a general explanation of how to map JNDI names using reference elements, see Mapping References.
Deploy the application client and EJB component together in an application.
For more information on deployment, see the Sun Java System Application Server 9.1 Application Deployment Guide. To get the client JAR file, use the --retrieve option of the asadmin deploy command.
To retrieve the stubs and ties whether or not you requested their generation during deployment, use the asadmin get-client-stubs command. For details, see the Sun Java System Application Server 9.1 Reference Manual.
Ensure that the client JAR file includes the following files:
A Java class to access the bean.
application-client.xml - (optional) Java EE application client deployment descriptor. For information on the application-client.xml file, see the Java EE 5 Specification, Section EE.9.7, “Java EE Application Client XML Schema.”
sun-application-client.xml - (optional) Application Server specific client deployment descriptor. For information on the sun-application-client.xml file, see The sun-application-client.xml file in Sun Java System Application Server 9.1 Application Deployment Guide.
The MANIFEST.MF file. This file contains a reference to the main class, which states the complete package prefix and class name of the Java client.
Prepare the client machine. This step is not needed for Java Web Start.
If you are using the appclient script, either package the application client to run on a remote client system using the package-appclient script, or copy the following JAR files to the client machine manually and include them in the classpath on the client side:
appserv-rt.jar - available at as-install/lib
javaee.jar - available at as-install/lib
The client JAR file
For more information, see Using the package-appclient Script.
Define the target-server element’s address attribute to reference the remote server machine. See target-server in Sun Java System Application Server 9.1 Application Deployment Guide.
Define the target-server element’s port attribute to reference the ORB port on the remote server.
This information can be obtained from the domain.xml file on the remote system. For more information on domain.xml file, see the Sun Java System Application Server 9.1 Administration Reference.
Some topics in the documentation pertain to features that are available only in domains that are configured to support clusters. Examples of domains that support clusters are domains that are created with the cluster profile or the enterprise profile. For information about profiles, see Usage Profiles in Sun Java System Application Server 9.1 Administration Guide.
If the Application Server instance on which the application client is deployed participates in a cluster, the ACC finds all currently active IIOP endpoints in the cluster automatically. However, a client should have at least two endpoints specified for bootstrapping purposes, in case one of the endpoints has failed.
The target-server elements specify one or more IIOP endpoints used for load balancing. The address attribute is an IPv4 address or host name, and the port attribute specifies the port number. See client-container in Sun Java System Application Server 9.1 Application Deployment Guide.
Run the application client.