J2EE application client |
|
|
![]() |
|
Configure and Run | TechNotes | JavaDoc | Build It Yourself |
Locating the source code |
Reviewing coding notes |
Locate the source code in the
This Sample shows how to use a very simple stateless session enterprise bean from a J2EE Application Client. It does not show examples of other J2EE application client features, such as Resource references or Environment entries. No database tables are required.
The TechnologySamples.ear file included with this Sample contains a subset of the TechnologySamples.ear file found within the Technology Samples on a server installation. The Web archive (WAR) files and unrelated Technology Samples are removed to illustrate what an Enterprise archive (EAR) file looks like when optimized for a client installation.
A client does not have the ability to regenerate deployment descriptors. The enterprise bean JAR file BasicCalculatorEJB.jar within the EAR file is deployed and skipped during the build process. If you need to update any server interfaces, build the code and redeploy the Technology Samples on a server installation and replace the BasicCalculatorEJB.jar file in the directory.
You can view examples of several key factors that go into assembling a J2EE WebSphere client application by opening the TechnologySamples.ear file with the Application Assembly Tool on a server installation as follows:
The Classpath field contains the BasicCalculatorEJB.jar and BasicCalculatorClientCommon.jar values. Your client application uses this field to access other class files in your EAR file. In this Sample, you access the EJB classes found in the BasicCalculatorEJB.jar file and the BasicCalculatorClient and BasicCalculatorClientResultBean classes, found in BasicCalculatorClientCommon.jar file. You can only use the Classpath field to access classes within the .ear file. If you need to access classes outside of this file, use the launchClient -CCclasspath parameter.
The Main Class field specifies which class in the client application runs by the launchClient command.
This field specifies the name to use in your client application. You can think of this name as an alias for the client application to use. You can make this value anything you want. The naming convention uses the prefix "ejb/" for EJB names.
Click the Bindings tab to find the JNDI name field. This value must match the one specified for the JNDI name on the Bindings tab in the EJB module for the bean. In this example, you can see that by clicking Basic Calculator EJB Module under the EJB Modules section. Click on Basic Calculator Stateless Session under Session Beans. When you click the Bindings tab, you see the value WSsamples/BasicCalculatorHome. The same value used for the Basic Calculator Client JNDI name.