520 IBM WebSphere Host Publisher Version 3.5
Figure 17-13 Output JSP
17.4.2 Scenario 2: Accessing Host Publisher EJB from remote JSPs
This scenario is similar to the previous one, but this time the sample JSP you
created must run in a WAS server where Host Publisher is not installed.
Therefore, the sample JSP and the EJB Access Bean will now be located on a
remote WAS server. The communication protocol between EJB Access Bean
and Host Publisher EJB is RMI over IIOP, as illustrated in Figure 17-14.
Note: When running JSP applications on a machine other than the one where
Host Publisher EJB (HPubEJB) is running, manual copies are required.
Figure 17-14 Accessing Host Publisher EJB from remote JSPs
Chapter 17. EJB application support 521
In this scenario, the request flow can be summarized as follows (see
Figure 17-14):
1. The JSP is accessed from the Web browser, for example via URL or a POST
operation. The JSP instantiates the EJB Access Bean.
2. When the execution method is invoked in the EJB Access Bean, it
communicates remotely with the Host Publisher EJB via RMI/IIOP. A
properties file in the EJB Access Bean .jar is used to locate the server
machine.
3. The Host Publisher EJB instantiates the Integration Object.
4. The Integration Object executes the host application.
Remote JSP application
In this scenario, an existing JSP application (EJBSample1) created in the
previous scenario is used. The process to enable access to the Host Publisher
EJB for this remote JSP application is described in this section.
Step 1: Copy the application directory
The remote application must be available in the remote machine where Host
Publisher is not available. For example, copy the EJBSample1 directory from the
Host Publisher Server machine to the remove WAS server directory:
WebSphere\Appserver\hosts\default_host\examples\web
The manually copied directory is shown in Figure 17-15 below.
522 IBM WebSphere Host Publisher Version 3.5
Figure 17-15 Sample JSP application files
Step 2: Copy the .jar files
Here you will need to copy the required .jar files into a classpath specified
directory. Alternatively, you can add the new directory to the application servers
classpath. In this scenario, the first option is used.
The files you will need to manually copy are:
򐂰 HPubCommon.jar
򐂰 Hobj01Access0.jar
򐂰 _wlm_DeployedHPubEJB.jar
The .jar files are copied for example to the servlets directory, as shown in
Figure 17-16 on page 523.
Note: These .jar files also use the ejs.jar, and ujc.jar, but they are already in a
classpath qualified directory.
Chapter 17. EJB application support 523
Figure 17-16 .jar files
Step 3: Modify EJB Access Bean properties file
In this step, you will need to update the <IOName>Access0.properties file, where
<IOname> is your Integration Object name. In this scenario, the IO name is
Hobj01. This properties file is inside the generated EJB Access Bean .jar file
(<IOName>Access0.jar).
You have two options to change the default values in the EJB Access Bean
properties file:
Note: If you have already changed the AccessEJB.properties file mentioned in
17.3, Adding EJB support to Integration Objects on page 509, this step is not
necessary.
524 IBM WebSphere Host Publisher Version 3.5
1. Edit the Hostpub\Studio\IntegrationObjects\EJB\AccessEJB.properties file
prior to generating the Integration Object. This file is used as input to create
the .properties file in the EJB Access Bean .jar file.
2. Alternatively, you can replace the .properties file in the EJB Access Bean .jar
file with a modified copy after the .jar file is generated.
The statement PROVIDER_URL (see Figure 17-17 on page 524) is where you
specify the host name and port of the name server used by the EJB client. The
property value must have the following format:
iiop://hostname:port
where hostname is the IP address or host name of the machine on which the
name server runs and port is the port number on which the name server listens.
For example, the property value
iiop://bankserver.mybank.com:9019
directs an EJB client to look for a name server on the host named
bankserver.mybank.com listening on port 9019.
The property value
iiop://bankserver.mybank.com
directs an EJB client to look for a name server on the host named
bankserver.mybank.com at port number 900.
The default property value
iiop:///
directs an EJB client to look for a name server on the local host listening on port
900.
Note: When the port is not specified, the default port 900 is used.
In this scenario, the value iiop://wtp3 (see Figure 17-17) directs the client to
look for a name server on the host named wtp3 listening on port 900 (default).
Figure 17-17 EJB Access Bean properties
#Fri Jun 01 16:34:08 EDT 2001
INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory
PROVIDER_URL=iiop://wtp3
JNDI_NAME=com_ibm_HostPublisher_EJB_HPubEJB

Get A Comprehensive Guide to IBM WebSphere Host Publisher Version 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.