14.4.2 Launching the J2EE client
A J2EE client application needs a container to run in. In this example, we will use the J2EE application client container. This container can be started using the launchClient program in the <<was_home>>/bin directory. The launchClient program has the following syntax:
launchClient [-profileName pName | -JVMOptions options | -help | -?] <userapp> [-CC<name>=<value>] [app args]The elements of syntax are:
-profileName Defines the profile of the Application Server process in a multi-profile installation. The -profileName option is not required for running in a single profile environment or in an Application Clients installation. The default is default_profile. -JVMOptions Valid Java standard or nonstandard option string. Insert quotation marks around the option string. -help, -? Print the usage information. <userapp.ear> Type the path/name of the .ear file containing the client application. -CCverbose Use this option with <true | false> to display additional informational messages. The default is false. -CCclasspath Classpath value. When an application is launched, the system classpath is not used. If access classes that are not in the EAR file or part of the resource classpaths, specify the appropriate classpath here. Multiple paths can be concatenated. -CCjar Name of the client JAR file within the EAR file that contains the application you want to launch. This argument is only necessary when you have multiple client JAR files in the EAR file. -CCBootstrapHost Name of the host server you want to connect to initially. The format is your.server.ofchoice.com. -CCBootstrapPort Server port number. If not specified, the WebSphere default value (2809) is used. -CCproviderURL Bootstrap server information that the initial context factory can use to obtain an initial context. WAS initial context factory can use either a CORBA object URL or an IIOP URL. CORBA object URLs are more flexible than IIOP URLs and are the recommended URL format to use. This value can contain more than one bootstrap server address. This feature can be used when attempting to obtain an initial context from a server cluster. In the URL, you can specify bootstrap server addresses for all servers in the cluster. The operation will succeed if at least one of the servers is running, eliminating a single point of failure. The address list does not process in a particular order. For naming operations, this value overrides the -CCBootstrapHost and -CCBootstrapPort parameters. An example of a CORBA object URL specifying multiple systems is: -CCproviderURL=corbaloc:iiop:myserver.mycompany.com:9810,:mybackupserver.mycompany.com:2809
-CCtrace Use this option with <true|false> to have WebSphere write debug trace information to a file. The value true is equivalent to a trace string value of com.*=all=enabled. Instead of the value true you can specify a trace string, for example, -CCtrace=com.ibm.ws.client.*=all=enabled. Multiple trace strings can be specified by separating them with a colon (:). You might need this information when reporting a problem to IBM Service. The default is false. -CCtracefile Name of the file to which to write trace information. The default is to output to the console. -CCpropfile Name of a properties file containing launchClient properties. In the file, specify the properties without the -CC prefix. For example: verbose=true. The app args are for use by the client application and are ignored by WebSphere.
To start the WebSphere Bank GetAccounts client using the launchClient command, execute the command shown in Figure 14-7.
Example 14-7 Launching WebSphere Bank application client
C:\WebSphere\AppServer\profiles\AppSrv01\bin>launchClient.bat c:\WebSphereBankClient.ear -CCBootstrapPort=2809 -CCjar=GetAccounts.jar 100
IBM WAS, Release 6.1 J2EE Application Client Tool Copyright IBM Corp., 1997-2006 WSCL0012I: Processing command line arguments. WSCL0013I: Initializing the J2EE Application Client Environment. WSCL0035I: Initialization of the J2EE Application Client Environment has completed. WSCL0014I: Invoking the Application Client class com.ibm.websphere.samples.bank.client.GetAccounts Get the account numbers owned by a certain customer
Getting the customer home...
Done....
Finding the customer.... Done.... Account Number: 101 All done!
Finding the customer from invoke .... Account Number: 101 All done!
Get accounts owned by customer from invoke... Account Number: 101 Account balance: 200.0 Get number of customer accounts from invoke... Account :1 All done!
Because the WebSphereBank EAR file contains multiple client applications (JAR files), the -CCjar option must be used to specify which client application to launch.
The WebSphere Bank GetAccounts client application is a text-mode application that simply displays the accounts for a certain customer number 100 in our example.