Updated for WebLogic 5.1
This example is based on the WebLogic Enterprise JavaBean container-managed persistence example, which is included in the standard WebLogic kit.
The standard example has a Java client which accesses a bank account, and adds/removes money, etc. Below we show a VB client which does pretty much the same thing. The EJB is unchanged, and has no knowledge that it is being accessed as a COM object.
The bridge and your WebLogic server can run on any JVM (including Java 2), on any platform (eg UNIX).
In order to run this example you will need to download the J-Integra®[tm] kit from http://j-integra.intrinsyc.com/
Unzip the kit on the VB Windows client (below we assume it has been unzipped to D:\jintegra). Copy the jintegra.jar file from the 'lib' subdirectory to the machine running the WebLogic server.
Follow the instructions for running the WebLogic container managed example which on my machine are in /weblogic/examples/ejb/basic/containerManaged/index.html. Make sure this standard WebLogic example runs correctly before proceeding. Examine the Client Java implementation to understand what it is that the VB client will do.
On the WebLogic machine, make sure the 'jintegra.jar' and 'weblogic.jar' are in
your CLASSPATH, then create a file "COMtoWebLogic.java"
file, cutting-and-pasting the following implementation from your
browser. If you are not running WebLogic using the default
configuration then you will need to modify the initial context:
// This is the bridge. The VB client talks to this |
Make sure your CLASSPATH includes the necessary WebLogic classes, and the J-Integra® runtime: (When running under Windows, my CLASSPATH contained: d:\jintegra\lib\jintegra.jar;.;D:\weblogic\lib\weblogicaux.jar;D:\weblogic\classes).
Compile COMtoWebLogic.java, and then run it, setting the JINTEGRA_DCOM_PORT property to 7050
> set CLASSPATH=.;C:\jintegra\lib\jintegra.jar;C:\bea\weblogic81\server\lib\weblogic.jar
> javac COMtoWebLogic.java
> java -DJINTEGRA_DCOM_PORT=7050 COMtoWebLogic
On your Windows VB client machine, tell J-Integra® about the location of the JVM, and the name that can be used to access Java objects through it. You will need to know the TCP/IP host name of the machine running the bridge you just started. If it is the same machine as the VB client, then use 'localhost', otherwise use the appropriate host name:
> D:\jintegra\bin\regjvmcmd.exe ejb localhost[7050]
Start up Visual BASIC, creating a standard project.
Test your GUI design skills to the limit by creating a form which
looks something like this:
The Account ID TextBox should be have the Name "AccountID"
Double-click on the button, and enter the following code for the
"Click" event:
|
Run the example:
1 2
345
12
3
4
If it doesn't work then check out the J-Integra® KB.
If you are familiar with COM then you will be pleased to know that J-Integra® also supports early bound access to COM objects.
J-Integra® also has a native mode, whereby the JVM can be loaded in-process into the COM client, so that the COM client talks RMI directly to the EJB.
Contact us with bug reports or enhancement suggestions at the J-Integra® discussion forum.