Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

Free Subscription to Java Pro

email article
printer friendly
get the code
more resources

Cross Pollination
Use Sun's JRE to locate and use JNDI resources running in WebSphere Application Server Version 5
by Kulvir Singh Bhogal

Posted May 12, 2004

Your organization invested its time and money in the development of server-side software components such as Enterprise JavaBeans (EJBs). These EJBs are powered by WebSphere Application Server (WAS) version 5. You have a client machine running Sun's Java Runtime Environment (JRE) and would like to use one of those EJBs powered by WAS. This should be easy right? We are simply talking communication from Java to Java, no? Unfortunately, it's a bit more complex than you might expect. I'll shed some light on the subject, showing you how you can use your WAS resources from a Sun JRE.

ADVERTISEMENT

The WAS Application Client contains a product called the pluggable application client that provides a Java application run time capable of interacting with WAS through the RMI-IIOP protocol. The Application Client ships with WebSphere Application Server Enterprise Edition on the CD labeled: Application Clients. The pluggable client is available only on the Windows platform. It requires that you have installed a compatible Sun JRE. Refer to the WAS Information Center (see Resources) regarding how to install the pluggable application client. I am going to assume that you have done this on a client machine that you would like to have interact with an instance of WAS. Note that the pluggable application client is quite finicky when it comes to supported JREs from Sun. For my experimentation, I used the JRE, Standard Edition build 1.4.1_05 (see Resources).

Preparing the Server Side
WebSphere Studio Application Developer Version 5.1.1 combined with the Pluggable Application Client can provide the necessary environment we need to emulate a client-server environment.

To emulate our server, we'll tap into Application Developer's built-in WebSphere Test Environment. We have provided an EAR (named CrossJREEar.ear), which you can download and deploy to the test environment. In this EAR is a stateless session EJB (2.0), which has one remote method exposed. The remote method finds the reciprocal of a given float. For example, if a parameter of 4/5 (.8) is provided, then the resulting reciprocal would be 5/4 (1.25). The EJB method doing our calculation is rather simple:

public float reciprocal(
  float reciprocateMe)
{
  return (1/reciprocateMe);
}

In Application Developer, create a new server and server configuration specifying a server type of WebSphere Version 5.1—test environment—(see Figure 1).

Go ahead and deploy the EAR, CrossJREEAR.ear, to the test environment you created. After deploying it, use the Universal Test Client to make sure the stateless session EJB is working as expected (see Figure 2).




Back to top













Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home