All Examples RMI over IIOP Examples
To get the most out of this example, first read through the source code files to see what is happening. Start with the XML deployment files to find the general structure of the EJBean, i.e. which classes are used for the different objects and interfaces, then look at Client.java to see how the application works.
The following steps summarize the crucial steps in establishing connectivity between an EJB and a Corba/C++ client:
-idl -iiop -idlNoValueTypes -idlOverwrite
2. Copy the jar file to the weblogic server deployment directory.
3. Generate the c++ stubs using idl2cpp compiler.
4. Compile the c++ stubs and client source file.
5. Link the objects file created by step 4 and create the executable.
6. Run the client: Client <Server IOR> (where the <Server IOR> is acquired from the utils.host2ior)
JAVA_HOME=c:/java/java130
WL_HOME=c:/weblogic
MYSERVER=c:/weblogic/myserver
CLASSPATH=$(JAVA_HOME)/jre/lib/rt.jar\;$(JAVA_HOME)/lib/tools.jar\;.\;$(WL_HOME)\;$(WL_HOME)/classes/boot\;\
$(WL_HOME)/lib/weblogic510sp6.jar\;$(WL_HOME)/classes\;$(WL_HOME)/tools\;$(WL_HOME)/license\;\
$(WL_HOME)/dev/src51/3rdparty/weblogicaux.jar\;./build
JAVAC=$(JAVA_HOME)/bin/javac -classpath $(CLASSPATH)
IDL2CPP=c:/Inprise/vbroker/bin/idl2cpp -no_servant -idl_strict
If you need more information on setting up your environment see the WebLogic document Setting your development environment.
EJB: build_dir
$(JAVAC) -d build $(BEAN_API) $(BEAN_IMPL)
$(JAVAC) -d $(MYSERVER)/clientclasses $(BEAN_API)
cd build && jar cv0f std_$(BEAN_JAR) META-INF examples
# running weblogic.ejbc to generate the idl files
$(JAVA_HOME)/bin/java -classpath $(CLASSPATH) -Dweblogic.home=$(WL_HOME) weblogic.ejbc -iiop -idl -idlNoValueTypes \
-idlOverwrite -idlDirectory idl build/std_$(BEAN_JAR) build/$(BEAN_JAR)
build_dir: mkdir -p build build/META-INF idl cpp/javax/ejb mkdir -p $(WL.HOME)/clientclasses mkdir -p $(WLHOME)/clientclasses/jidlclasses cp -f ejb-jar.xml weblogic-ejb-jar.xml build/META-INF
cppclient: $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp idl/examples/rmi_iiop/ejb/simplified_idl/MyBean.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp idl/examples/rmi_iiop/ejb/simplified_idl/MyBeanHome.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/javax/ejb idl/javax/ejb/EJBObject.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/javax/ejb idl/javax/ejb/EJBHome.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/javax/ejb idl/javax/ejb/RemoveEx.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/javax/ejb idl/javax/ejb/CreateEx.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/java/lang idl/java/lang/_Object.idl $(IDL2CPP) -Ic:/Inprise/vbroker/idl -namespace -Iidl -src_suffix cpp -root_dir cpp/java/rmi idl/java/rmi/Remote.idl
CL /MD /DTHREAD /nologo -DWIN32 /GX /DSTRICT /DALIGNED /DVISIBROKER /DMSVCUSING_BUG /DMSVCNESTEDUSING_BUG -Icpp \ -Ic:/Inprise/vbroker/include -Ic:/Inprise/vbroker/include/stubs -Ic:/weblogic/dev/src51 -c MyBean_c.cpp \ MyBeanHome_c.cpp cpp/Client.cpp cpp/javax/ejb/EJBObject_c.cpp cpp/javax/ejb/EJBHome_c.cpp \ cpp/javax/ejb/RemoveEx_c.cpp cpp/java/lang/_Object_c.cpp cpp/java/rmi/Remote_c.cpp
LINK /nologo /out:Client.exe /LIBPATH:c:/Inprise/vbroker/lib MyBean_c.obj MyBeanHome_c.obj EJBObject_c.obj EJBHome_c.obj \ RemoveEx_c.obj _Object_c.obj Remote_c.obj Client.obj
To the weblogic.properties file, add the following: weblogic.ejb.deploy=$(WL-Home)/myserver/examples.rmi_iiop.ejb.simple.jar. You'll need to adjust this property depending on which EJBeans you're building and are deploying, or if the location of the files differs from the installed location.
Note: If you're running under the Microsoft SDK for Java, you'll also need to add the path to the .jar to the CLASSPATH for your WebLogic Server.
$ set CLASSPATH=%CLASSPATH%;weblogic\myserver\ejb_basic_statelessSession.jarwhere weblogic is the installation directory for WebLogic Server.
Client <IOR> Parameters are optional, but if any are supplied, they are interpreted in this order: url - URL such as "iiop://localhost:7001" user - User name, default null password - User password, default null
Client output: Buying 100 shares Buying 200 shares Buying 300 shares Buying 400 shares Buying 500 shares Buying 600 shares Buying 700 shares Buying 800 shares Buying 900 shares Buying 1000 shares This is the server output: Buying 100 shares Attempt to buy 200 is greater than limit of 100 Buying 100 shares Attempt to buy 300 is greater than limit of 100 Buying 100 shares Attempt to buy 400 is greater than limit of 100 Buying 100 shares Attempt to buy 500 is greater than limit of 100 Buying 100 shares Attempt to buy 600 is greater than limit of 100 Buying 100 shares Attempt to buy 700 is greater than limit of 100 Buying 100 shares Attempt to buy 800 is greater than limit of 100 Buying 100 shares Attempt to buy 900 is greater than limit of 100 Buying 100 shares Attempt to buy 1000 is greater than limit of 100 Buying 100 shares
Read more about WebLogic RMI over IIOP in the Developer Guide, Using WebLogic RMI over IIOP.
Read more about WebLogic EJB in the Developer Guide, BEA WebLogic Server Enterprise JavaBeans.
Read more about WebLogic RMI in the Developer Guide, Using WebLogic RMI.
Copyright © 2000 BEA Systems, Inc. All rights reserved.