Setting up the TCP/IP listener for a called appl in a J2EE appl client module
If you want a caller to use TCP/IP to exchange data with a called program in a J2EE application client module, set up a TCP/IP listener for the called program.
You need to make sure that the following situation is in effect:
- An EGL-specific TCP/IP listener is the main class for the module, as specified in the manifest (.MF) file of the module
- A port is assigned to the listener, as specified in the deployment descriptor (application-client.xml) of the module
If you are working with projects at the level of J2EE 1.2, it is recommended that you set up an application client project that is initialized with the listener, before you generate any EGL code into that project. If you fail to follow that sequence (listener first, EGL code second) or if you are working with projects at the level of J2EE 1.3, you need to follow the procedure described in Providing access to the listener from an existing application client project.
Setting up an application client project that is initialized with the listener
To set up an application client project that is initialized with the listener, do as follows:
- Click File > Import.
- At the Select page, double-click App Client JAR file.
- At the Application Client Import page, specify several details--
- In the Application Client file field, specify the jar file that sets up access to (but does not include) the TCP/IP listener:
installationDir\egl\eclipse\plugins\ com.ibm.etools.egl.generators_version\runtime\EGLTcpipListener.jar
- installationDir
- The product installation directory, such as C:\Program Files\IBM\RSPD\6.0. If you installed and kept a Rational Developer product before installing the product that you are using now, you may need to specify the directory that was used in the earlier install.
- version
- The latest version of the plugin; for example, 6.0.0.
The TCP/IP listener itself resides in fdaj6.jar, which is placed in the application client project when you first generate EGL code into that project.
- Click the New radio button, which follows the label Application Client project.
- Type the name of the application client project into the New Project Name field; then set or unset the Use default check box. If you set the check box, the project is stored in a workspace directory that is named with the name of the project. If you unset the check box, specify the project name in the New project location field.
- Specify the name of the enterprise application project that contains the application client project:
- If you are using an existing J2EE 1.2 enterprise application project, click the Existing radio button, which follows the label Enterprise application project. In this case, specify the project name in the Existing project name field.
- If you are creating a new enterprise application project, do as follows:
- Click the New radio button, which follows the label Enterprise application project.
- Type the name of the enterprise application project into the New Project Name field.
- Set or unset the Use default check box.
- If you set the check box, the project is stored in a workspace directory that is named with the name of the project. If you unset the check box, specify the project name in the New project location field.
- Click Finish.
- Ignore the two warning messages that refer to the jar files (fda6.jar, fdaj6.jar) that will be added automatically when you generate EGL output into the project.
In the application client project, the deployment descriptor property tcpiplistener.port is set to the number of the port at which the listener receives data. By default, that port number is 9876. To change the port number, do as follows:
- In the Project Explorer view, expand your application client project, then appClientModule, then META-INF
- Click application-client.xml > Open With > Deployment Descriptor editor
- The deployment descriptor editor includes a source tab; click that tab and change the 9876 value, which is the content of the last tag in a grouping like this:
<env-entry-name>tcpiplistener.port</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-name> <env-entry-value>9876</env-entry-value>- To save the deployment descriptor, press Ctrl-S.
Providing access to the listener from an existing application client project
If you generate EGL code into an application client project that was not initialized with the listener, you need to update the deployment descriptor (application-client.xml) and the manifest file (MANIFEST.MF):
- In the Project Explorer view, expand your application client project, then appClientModule, then META-INF
- Click application-client.xml > Open With > Deployment Descriptor Editor
- The deployment descriptor editor includes a Source tab. Click that tab. In the text, immediately below the line that holds the tag <display-name>, add the following entries (however, if port 9876 is already in use on your machine, substitute a different number for 9876):
<env-entry> <env-entry-name>tcpiplistener.port</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-name> <env-entry-value>9876</env-entry-value> </env-entry>- To save the deployment descriptor, press Ctrl-S.
- In the Project Explorer view, click MANIFEST.MF > Open With > JAR Dependency Editor.
- The JAR Dependency Editor includes a Dependencies tab. Click that tab.
- Review the Dependencies section to make sure that fda6.jar and fdaj6.jar are selected.
- In the Main Class section, in the Main-Class field, type the following value or use the Browse mechanism to specify the following value:
CSOTcpipListenerJ2EE- To save the manifest file, press Ctrl-S.
Deploying the application client project
To start the TCP/IP listener, follow either of two procedures:
- Start the listener from the Workbench by using the launch configuration for a WebSphere application client:
- Switch to a J2EE perspective
- Click Run > Run
- At the Launch Configurations page, click either WebSphere v5 Application Client (as is necessary if you are working with a project at the level of J2EE 1.3) or WebSphere v4 Application Client
- Select an existing configuration. Alternatively, click New and set up a configuration:
- In the Application tab, select the enterprise application project
- In the Arguments tab, add an argument:
-CCjar=myJar.jar
- myJar.jar
- The name of the application client jar file. This argument is only necessary when you have multiple client jar files in the ear file. In most cases, the value is the name of the application client project, followed by the extension .jar.
If you wish to confirm the relationship of project name to jar-file name, do as follows:
- In the Project Explorer view, expand your enterprise application project, then META-INF
- Click application.xml > Open With > Deployment Descriptor Editor.
- The Deployment Descriptor editor includes a Module tab. Click that tab.
- At the leftmost part of the page, click the jar file and see (at the rightmost part of the page) the project name associated with that jar file.
- If you have on WebSphere Application Server (WAS) installed, you can use launchClient.bat, which is in the WAS installation directory, subdirectory bin.
You can invoke launchClient as follows from a command prompt:
launchClient myCode.ear -CCjar=myJar.jar
- myCode.ear
- The name of the enterprise archive
- myJar.jar
- The name of the application client jar file, as described in relation to the Workbench procedure
For details on launchClient.bat, see the WebSphere Application Server documentation.
Related tasks
Providing access to non-EGL jar files
Setting up the J2EE run-time environment for EGL-generated code