[ Team LiB ] Previous Section Next Section

Zero Client Installs

A zero client installation (as J-Integra calls it) is available with jCOM. This refers to an environment setup where COM clients can access Java objects without any WebLogic-specific code required on the client machine. It's the least intrusive of any option in terms of impact to the client, but it does require the location of the WebLogic Server to be hardcoded into the client code where the call initiates from.

When COM clients make calls to jCOM-exposed Java objects, they need some means of determining exactly where the Java objects they're calling are located. In COM, components are referenced by a human-readable string called a moniker or through the use of a machine-readable unique identifier called a class ID. For example, in Visual Basic, GetObject("prodServer:com.acme.widgetclass") is an example of a moniker reference. jCOM maps monikers and class IDs to Java classes, which run in a specific JVM identified by a JVM ID. The prodServer in the moniker reference is the JVM ID used to identify the particular Java virtual machine being called.

With jCOM, COM clients can identify a WebLogic Server in two different ways. One way, which we delve into in more detail later, is to use the jCOM-provided regjvm tool to place an entry in the client machine's registry. The other is the zero client form we're discussing here, where the server location is hardcoded into the client. Zero client installs leave it up to the internal COM client code to locate the WebLogic Server by referring to an object reference moniker for the server.

There are two methods of obtaining the object reference moniker for the WebLogic Server you're going to call. By default, WebLogic Server comes preloaded with a servlet that you can access to display the object reference moniker for that particular server. Start WebLogic and point your browser to http://localhost:7001/bea_wls_internal/com (change the server address and port number if required). What you'll see is an encoded string containing the IP address of the WebLogic Server and the port number it's listening on. You simply cut and paste this string into the client code. Please note that this servlet is installed only with the examples server.

Alternatively, you can run the com.bea.jcom.GetJvmMoniker Java class directly to access this information. Specify the full name or TCP/IP address of the WebLogic Server machine and port number as parameters in the form


java com.bea.jcom.GetJvmMoniker localhost 7001

The text displayed is also automatically copied to the clipboard for you to paste into your code. The moniker you receive through either of these methods remains valid as long as the host and port number of the server remain unchanged. In Visual Basic, you would place the object reference moniker into your code like this:

  • Set jvm = GetObject("objref:TUVPVwEAAAAABAIAAAAAAMAMQBdAAAAAAAKAP//AAAAAAAAA......")

  • Set vector = jvm.get("java.util.Vector")

An EJB should be accessed through JNDI like this:

  • Set jvm = GetObject("objref:TUVPVwEAAAAABAIAAAAAAMAMQBdAAAAAAAKAP//AAAAAAAAA......")

  • Set mobjHome = jvm.get("prodServer:jndi:MyEJBHome")

The upside to a zero client installation is that it affords you the least amount of overhead at deployment time. This could be advantageous if you have a large number of clients to install and you're fairly certain that the server IP and port number will remain constant. If either of these does change, you must remember to obtain a new moniker from the server and reinsert it into the code on all the client machines. Early binding, which we'll learn about shortly, is not supported at all on a zero client which might or might not be a desirable thing.

    [ Team LiB ] Previous Section Next Section