These session snippets show how I installed and ran JacORB on MPE/iX. also see http://www.inf.fu-berlin.de/~brose/jacorb/ Notice that I am using MPE/iX 5.5 and Java/iX 1.1.7 only to show that it does not even seem to require the latest versions to work (at least for those examples that I tried). As usual, this is "not HP supported" and "use at your own risk" ;-) MPE/iX:hello lars,manager.sys HP3000 Release: C.55.00 User Version: C.55.00 SAT, JUL 8, 2000, 4:48 PM MPE/iX HP31900 C.05.08 Copyright Hewlett-Packard 1987. All rights reserved. :newacct ix,mgr ;pass=acctpw :newacct ix,mgr ;onvs=user_set :altuser mgr.ix ;pass=mgrpw :altacct ix ;cap=+ph :# let's create a CORBA.IX user for Voyager, JacORB and EngineRoom experiments :newgroup corba.ix ;onvs=user_set :newgroup corba.ix ;homevs=user_set ;access=(r,x:ac; w,a,l,s:gl) :newuser corba.ix ;home=corba ;pass=userpw :altuser corba.ix ;cap=+ph,gl :hello lars,corba.ix HP3000 Release: C.55.00 User Version: C.55.00 SAT, JUL 8, 2000, 4:51 PM MPE/iX HP31900 C.05.08 Copyright Hewlett-Packard 1987. All rights reserved. :newdir temp Created directory "TEMP.CORBA.IX". :chdir temp CWD is "TEMP.CORBA.IX". :# at this point we upload the JacORB 1.1 CORBA zip file to the 3000 :# this can be done with ftp or terminal emulator file transfer or by :# using samba to access the MPE/iX file system; you could even pull :# the file directly off the Internet, if you have GNU wget for MPE/iX :# installed and the 3000 can access the Internet either directly or :# through a web proxy. :listfile ./@ ,2 PATH= /IX/CORBA/TEMP/ CODE ------------LOGICAL RECORD----------- ----SPACE---- FILENAME SIZE TYP EOF LIMIT R/B SECTORS #X MX 1B BA 5177506 2147483647 1 20240 13 32 JacORB1_1-full.zip :xeq /usr/local/bin/unzip JacORB1_1-full.zip Archive: JacORB1_1-full.zip creating: JacORB1_1/ extracting: JacORB1_1/ANT-RC inflating: JacORB1_1/COPYING.LIB-2.0 inflating: JacORB1_1/ChangeLog inflating: JacORB1_1/INSTALL inflating: JacORB1_1/README inflating: JacORB1_1/REL_NOTES inflating: JacORB1_1/build.xml . . . inflating: JacORB1_1/src/omg-99-10-27/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java creating: JacORB1_1/src/omg-99-10-27/org/omg/PortableServer/portable/ inflating: JacORB1_1/src/omg-99-10-27/org/omg/PortableServer/portable/Delegate.java : :# Notice that JacORB is Open Source i.e. comes with source code! :xeq /bin/chmod "-R go-w JacORB1_1" :xeq /bin/mv "JacORB1_1 .." :chdir .. CWD is "/IX/CORBA". :purgedir temp ;tree Purge ALL files below and including "TEMP.CORBA.IX"? (ALL/NO)all :listfile ./@ ,2 PATH= /IX/CORBA/ CODE ------------LOGICAL RECORD----------- ----SPACE---- FILENAME SIZE TYP EOF LIMIT R/B SECTORS #X MX 16W HBD 0 67107839 1 32 1 * JacORB1_1/ :# for convenience reasons, we create a command file to launch the :# Posix Shell with larger NMSTACK and or NMHEAP values, as this might :# be needed to prevent fork()ed Java children to run OutOfMemory :editor HP32201A.09.00 EDIT/3000 SAT, JUL 8, 2000, 4:58 PM (C) HEWLETT-PACKARD CO. 1993 /a 1 parm info="-L", nmstack=10240000, nmheap=10240000 2 run /bin/sh ;info="!info" ;nmstack=!nmstack ;nmheap=!nmheap 3 // ... /k shell,unn /e END OF SUBSYSTEM : :shell ,20480000,20480000 shell/iX> cd JacORB1_1 shell/iX> ls -l -rw-r--r-- 1 CORBA.IX IX 22 Mar 29 11:32 ANT-RC -rw-r--r-- 1 CORBA.IX IX 25265 Aug 5 1999 COPYING.LIB-2.0 -rw-r--r-- 1 CORBA.IX IX 139288 Jan 28 15:30 ChangeLog -rw-r--r-- 1 CORBA.IX IX 4458 Apr 4 15:25 INSTALL -rw-r--r-- 1 CORBA.IX IX 1357 Feb 10 10:59 README -rw-r--r-- 1 CORBA.IX IX 13854 Apr 4 15:23 REL_NOTES drwxr-xr-x 2 CORBA.IX IX 2816 Apr 4 16:44 bin -rw-r--r-- 1 CORBA.IX IX 14320 Mar 30 14:55 build.xml drwxr-xr-x 20 CORBA.IX IX 2048 Apr 4 16:44 demo drwxr-xr-x 3 CORBA.IX IX 416 Apr 4 16:47 doc drwxr-xr-x 4 CORBA.IX IX 416 Apr 4 16:44 idl -rwxr-xr-x 1 CORBA.IX IX 3627 Apr 4 12:24 jacorb_properties.template drwxr-xr-x 2 CORBA.IX IX 416 Apr 4 17:39 lib -rwxr-xr-x 1 CORBA.IX IX 151 Mar 23 21:14 orb.properties -rw-r--r-- 1 CORBA.IX IX 4164 Mar 30 09:40 readmeSSL drwxr-xr-x 6 CORBA.IX IX 704 Apr 4 17:42 src shell/iX> ls bin appligator imr jacapplet nmg.bat trader.bat appligator.bat imr.bat jaco ns ts dior imr_mg jaco.bat ns.bat ts.bat dior.bat imr_mg.bat lsns pingo idl imr_ssd lsns.bat pingo.bat idl.bat imr_ssd.bat nmg trader shell/iX> ls lib idl.jar jacorb.jar shell/iX> ls doc ProgrammingGuide.ps collection shell/iX> ls demo any benchmark dii hello poa_monitor applet build.xml dynany interceptors transaction arrays concurrency events mtclient unions bank demo grid outparam shell/iX> ls src jacorb java_mapping org.omg.99-10-27.jar java_cup omg-99-10-27 shell/iX> # notice that the JacORB documentation comes as Postcript shell/iX> # file, so you either need to print it or use GhostScript shell/iX> # freeware to view it online shell/iX> # also notice that the bin directory contains several shell shell/iX> # script and DOS batch file examples, however, instead of shell/iX> # customizing them, we'll use or own set of shell variables shell/iX> # and alias definitions here... shell/iX> cat > useful alias java1="/usr/local/java/jdk1.1.7/bin/java -nojit" alias java1c="/usr/local/java/jdk1.1.7/bin/javac -J-nojit" export CLASSPATH=:$PWD/lib/jacorb.jar:$PWD/lib/idl.jar orb="-Dorg.omg.CORBA.ORBClass=jacorb.orb.ORB" singleton="-Dorg.omg.CORBA.ORBSingletonClass=jacorb.orb.ORBSingleton" verbose="-Djacorb.verbosity=2" naming="-Djacorb.NameServerURL=file:/IX/CORBA/JacORB1_1/ns.IOR" alias jaco="java1 \$orb \$singleton \$naming" alias idl="java1 jacorb.idl.parser" alias dior="jaco jacorb.orb.util.PrintIOR" alias ns="jaco jacorb.naming.NameServer" :eod shell/iX> . useful shell/iX> # let's start with the hello demo... shell/iX> cd demo/hello shell/iX> ls Applet.java GoodDayImpl.java build.xml Client.java Server.java server.idl shell/iX> # we won't use Jakarta ANT as "make tool" but do it manually... shell/iX> idl -help -syntax syntax check only, no code generation, implies -no_ir -noskel disables generation of POA skeletons -Idir set include path for idl files -Dx define preprocessor symbol x with value 1 -Dx=y define preprocessor symbol x with value y -U undefine preprocessor symbol -p pack apply pack as prefix to all names in generated Java code and put code into package -i2jpackage x:a.b.c replace IDL package name x by a.b.c in generated Java code (e.g. CORBA:org.omg.CORBA) -i generated Java code will include "import ;" -global_import generated Java code will include import statements for all global types -d dir root of directory tree for output -all generate code for all IDL files, even included ones -v|version print version information -h|help these few lines of help shell/iX> # first generate the "glue" classes from the IDL definition... shell/iX> idl -p demo -d ../.. server.idl shell/iX> ls Applet.java GoodDayImpl.java _GoodDayStub.java Client.java GoodDayOperations.java build.xml GoodDay.java GoodDayPOA.java server.idl GoodDayHelper.java GoodDayPOATie.java GoodDayHolder.java Server.java shell/iX> # created quite a number of files (compared to Voyager :-) shell/iX> cd ../.. shell/iX> # now we compile the client and server... shell/iX> java1c demo/hello/Server.java demo/hello/Client.java shell/iX> # and now we are ready to launch the server and trigger it shell/iX> # with a client run in a separate session; after the test, shell/iX> # the server is aborted (as it is not written to also offer shell/iX> # a graceful shutdown... shell/iX> alias jaco jaco="java1 \$orb \$singleton \$naming" shell/iX> jaco demo.hello.Server Germany > hello.IOR | MPE/iX:hello lars,corba.ix | | HP3000 Release: C.55.00 User Version: C.55.00 SAT, JUL 8, 2000, 5:31 PM | MPE/iX HP31900 C.05.08 Copyright Hewlett-Packard 1987. All rights reserved. | | :shell ,20480000,20480000 | | shell/iX> cd J* | shell/iX> . useful | | shell/iX> # here is the IOR file created by the server program... | | shell/iX> ls -l *.IOR | -rw-rw---- 1 CORBA.IX IX 341 Jul 8 17:35 hello.IOR | | shell/iX> cat -v hello.IOR | IOR:000000000000001649444c3a68656c6c6f2f476f6f644461793a312e30000000000000030000 | 000000000030000100000000000c31352e3134302e382e333400eec6000000000014383136393733 | 3530392f00100049242325332c110000000000000034000101000000000c31352e3134302e382e33 | 3400eec60000000000143831363937333530392f00100049242325332c1100000000000000010000 | 00080000000000000000 | | shell/iX> read ior < hello.IOR | | shell/iX> # this will save us some clumsy cut and paste ;-) | | shell/iX> # by the way, JacORB has a tool to decode/display the IOR... | | shell/iX> alias dior | dior="jaco jacorb.orb.util.PrintIOR" | | shell/iX> dior -f hello.IOR | ------IOR components----- | TypeId : IDL:hello/GoodDay:1.0 | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61126 | Object key : 0x38 31 36 39 37 33 35 30 39 2F 00 10 00 49 24 23 25 33 2C 11 | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61126 | Object key : 0x38 31 36 39 37 33 35 30 39 2F 00 10 00 49 24 23 25 33 2C 11 | Profile Id : TAG_MULTIPLE_COMPONENTS | | | shell/iX> # and here we run the client, which receives "Germany" from the server | | shell/iX> jaco demo.hello.Client $ior | Hello World, from Germany | | shell/iX> # back in the server window, we abort the server program then... :abort Program aborted per user request. (CIERR 989) : :shell ,40960000,40960000 shell/iX> cd J* shell/iX> . useful shell/iX> # now let's move on to the grid example... shell/iX> cd demo/grid shell/iX> ls Client.java build.xml server.idl Server.java gridImpl.java TieServer.java gridOperationsImpl.java shell/iX> # we first generate the "glue" classes from the IDL definition... shell/iX> idl -p demo -d ../.. server.idl shell/iX> ls -F Client.java MyServerPOA.java _MyServerStub.java MyServer.java MyServerPOATie.java build.xml MyServerHelper.java MyServerPackage/ gridImpl.java MyServerHolder.java Server.java gridOperationsImpl.java MyServerOperations.java TieServer.java server.idl shell/iX> ls -F MyServerPackage MyException.java MyExceptionHolder.java fixedTHolder.java MyExceptionHelper.java fixedTHelper.java shell/iX> # and now we compile the source files... shell/iX> cd ../.. shell/iX> java1c demo/grid/Server.java demo/grid/Client.java shell/iX> ls -RF demo/grid demo/grid: Client.class MyServerOperations.java _MyServerStub.java Client.java MyServerPOA.class build.xml MyServer.class MyServerPOA.java gridImpl.class MyServer.java MyServerPOATie.java gridImpl.java MyServerHelper.class MyServerPackage/ gridOperationsImpl.java MyServerHelper.java Server.class server.idl MyServerHolder.java Server.java MyServerOperations.class TieServer.java demo/grid/MyServerPackage: MyException.class MyExceptionHelper.java fixedTHelper.java MyException.java MyExceptionHolder.java fixedTHolder.java MyExceptionHelper.class fixedTHelper.class shell/iX> # quite a lot of code, huh? ;-) shell/iX> # the grid example can either be run with IOR or Naming Server shell/iX> # we first run it with IOR file, similar to the hello example, shell/iX> # trigger it from the other session and finally abort it again shell/iX> jaco demo.grid.Server grid.IOR | shell/iX> # we pick up the IOR created by the server... | | shell/iX> read ior < grid.IOR | | shell/iX> jaco demo.grid.Client $ior | java.lang.NoClassDefFoundError: demo/grid/_MyServerStub | at demo.grid.MyServerHelper.narrow(MyServerHelper.java:39) | at demo.grid.Client.main(Client.java:17) | | shell/iX> # looks like we missed one during compile -- better had used *.java | | shell/iX> java1c demo/grid/_MyServerStub.java | | shell/iX> # so let's try it again... | | shell/iX> jaco demo.grid.Client $ior | Height = 31 | Width = 14 | Old value at (30,13): 0.21 | Setting (30,13) to 470.11 | New value at (30,13): 470.11 | MyException, reason: This is only a test exception, no harm done :-) | done. :abort Program aborted per user request. (CIERR 989) : :shell ,20480000,20480000 shell/iX> cd J* shell/iX> . useful shell/iX> # now the same grid demo with IOR, but more verbose... shell/iX> jaco $verbose demo.grid.Server grid.IOR [ POA RootPOA - ready ] [ POA RootPOA - oid: 00 10 00 49 2B 06 37 3F 01 4D 2D - object is activated ] | shell/iX> # and here the matching grid Client test, also more verbose | | shell/iX> read ior < grid.IOR | | shell/iX> jaco $verbose demo.grid.Client $ior | [ New connection to 15.xxx.x.xx:61148 ] | Height = 31 | Width = 14 | Old value at (30,13): 0.21 | Setting (30,13) to 470.11 | New value at (30,13): 470.11 | MyException, reason: This is only a test exception, no harm done :-) | [ releasing connection to 15.xxx.x.xx:61148 ] | [ Closing connection to 15.xxx.x.xx:61148 ] | done. | | shell/iX> # back in the server window we can see additonal messages... [ Accepted connection from 127.0.0.1:61156 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: _get_height - process request ] [ POA RootPOA - rid: 1 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: _get_width - process request ] [ POA RootPOA - rid: 2 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: get - process request ] [ POA RootPOA - rid: 3 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: set - process request ] [ POA RootPOA - rid: 4 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: get - process request ] [ POA RootPOA - rid: 5 oid: 00 10 00 49 2B 06 37 3F 01 4D 2D opname: opWithException - process request ] [ Closing connection to 127.0.0.1:61156 ] :abort Program aborted per user request. (CIERR 989) : :shell ,20480000,20480000 shell/iX> cd J* shell/iX> . useful shell/iX> # before starting grid demo with Naming, we need a third window... 3| MPE/iX:hello lars,corba.ix 3| 3| HP3000 Release: C.55.00 User Version: C.55.00 SAT, JUL 8, 2000, 5:58 PM 3| MPE/iX HP31900 C.05.08 Copyright Hewlett-Packard 1987. All rights reserved. 3| 3| :shell ,20480000,20480000 3| 3| shell/iX> cd J* 3| shell/iX> . useful 3| 3| shell/iX> alias ns 3| ns="jaco jacorb.naming.NameServer" 3| 3| shell/iX> alias jaco 3| jaco="java1 \$orb \$singleton \$naming" 3| 3| shell/iX> echo $naming 3| -Djacorb.NameServerURL=file:/IX/CORBA/JacORB1_1/ns.IOR 3| 3| shell/iX> pwd 3| /IX/CORBA/JacORB1_1 3| 3| shell/iX> ls *.IOR 3| grid.IOR hello.IOR 3| 3| shell/iX> # we don't use the ns alias here, we want more verbosity... 3| 3| shell/iX> jaco $verbose jacorb.naming.NameServer 3| Usage: java jacorb.naming.NameServer [ ] 3| shell/iX> jaco $verbose jacorb.naming.NameServer ns.IOR 3| [ POA RootPOA - ready ] 3| [ POA NameServer-POA - ready ] 3| [ POA RootPOA - oid: 00 10 00 49 2C 24 4A 02 4B 4B - object is activated ] 3| [ NS up ] shell/iX> # now that ns is launched, we can start the grid server, trigger shell/iX> # another client request from the second window and finally stop shell/iX> # the server again... shell/iX> # notice that we keep the NamingServer in the third window running shell/iX> # all the time, but we don't display the additional messages here shell/iX> jaco $verbose demo.grid.Server [ POA RootPOA - ready ] [ POA RootPOA - oid: 00 10 00 49 2C 36 36 23 01 3D 2B - object is activated ] | shell/iX> # before we start the client, we peek at the ns.IOR file... | | shell/iX> ls -l *.IOR | -rw-rw---- 1 CORBA.IX IX 357 Jul 8 17:55 grid.IOR | -rw-rw---- 1 CORBA.IX IX 341 Jul 8 17:35 hello.IOR | -rw-rw---- 1 CORBA.IX IX 429 Jul 8 18:01 ns.IOR | | shell/iX> dior -f ns.IOR | ------IOR components----- | TypeId : IDL:omg.org/CosNaming/NamingContextExt:1.0 | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61158 | Object key : 0x53 74 61 6E 64 61 72 64 4E 53 2F 4E 61 6D 65 53 65 72 76 65 72 | 2D 50 4F 41 2F 5F 72 6F 6F 74 | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61158 | Object key : 0x53 74 61 6E 64 61 72 64 4E 53 2F 4E 61 6D 65 53 65 72 76 65 72 | 2D 50 4F 41 2F 5F 72 6F 6F 74 | Profile Id : TAG_MULTIPLE_COMPONENTS | | shell/iX> # with naming server and grid server started, we can launch client | | shell/iX> alias jaco | jaco="java1 \$orb \$singleton \$naming" | | shell/iX> echo $naming | -Djacorb.NameServerURL=file:/IX/CORBA/JacORB1_1/ns.IOR | | shell/iX> echo $verbose | -Djacorb.verbosity=2 | | shell/iX> jaco $verbose demo.grid.Client | [ New connection to 15.xxx.x.xx:61158 ] | [ New connection to 15.xxx.x.xx:61166 ] | Height = 31 | Width = 14 | Old value at (30,13): 0.21 | Setting (30,13) to 470.11 | New value at (30,13): 470.11 | MyException, reason: This is only a test exception, no harm done :-) | [ releasing connection to 15.xxx.x.xx:61166 ] | [ Closing connection to 15.xxx.x.xx:61166 ] | done. | | shell/iX> # quite impressive to see all three windows scroll messages :-) | | shell/iX> # back in the server window we can see additonal messages... [ New connection to 15.xxx.x.xx:61158 ] [ Accepted connection from 127.0.0.1:61176 ] [ Closing connection to 15.xxx.x.xx:61158 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: _non_existent - process request ] [ ServantDelegate: non_existent: return false ] [ Accepted connection from 127.0.0.1:61177 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: _get_height - process request ] [ POA RootPOA - rid: 1 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: _get_width - process request ] [ POA RootPOA - rid: 2 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: get - process request ] [ POA RootPOA - rid: 3 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: set - process request ] [ POA RootPOA - rid: 4 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: get - process request ] [ POA RootPOA - rid: 5 oid: 00 10 00 49 2C 36 36 23 01 3D 2B opname: opWithException - process request ] [ Closing connection to 127.0.0.1:61177 ] :abort Program aborted per user request. (CIERR 989) :shell ,40960000,40960000 shell/iX> cd J* shell/iX> . useful shell/iX> # after the grid demo, we now move to the home-grown Adder shell/iX> # example, that was also used during the Voyager experiments shell/iX> mkdir demo/lars shell/iX> # you won't find the Adder example in the JacORB package, though shell/iX> cd demo/lars shell/iX> ls -l -rwxr----- 1 CORBA.IX IX 1057 Jul 7 14:55 AdderImp.java -rwxr----- 1 CORBA.IX IX 1615 Jul 7 17:35 Client.java -rwxr----- 1 CORBA.IX IX 1191 Jul 7 17:22 Server.java -rwxr----- 1 CORBA.IX IX 174 Jul 7 14:50 adder.idl shell/iX> cat adder.idl // example for use with JacORB interface AdderInt { long add(in long a, in long b) raises( Negative ); long getTotal(); }; exception Negative { string msg; }; shell/iX> cat AdderImp.java // example for use with JacORB import org.omg.CORBA.*; class AdderImp extends AdderIntPOA { /** * total keeps track of add() results, even negative ones */ int total; /** * constructor sets total to zero */ AdderImp() { System.out.println( "Adder: init" ); total = 0; } /** * add() returns the sum or throws an exception, if negative */ public int add(int a, int b) throws Negative { System.out.println( "Adder: add, in=" + a + "," + b ); int sum = a + b; total += sum; if (sum < 0) { System.out.println( "Adder: add throws exception for sum " + sum ); throw new Negative("Adder.add result was " + sum); } else { System.out.println( "Adder: add returns sum " + sum ); return sum; } } /** * getTotal() returns the running total of all add() calls */ public int getTotal() { System.out.println( "Adder: getTotal returns " + total ); return total; } } shell/iX> cat Server.java // test server for Adder example import org.omg.CORBA.*; import org.omg.PortableServer.*; import org.omg.CosNaming.*; import java.io.DataOutputStream; import java.io.FileOutputStream; class Server { public static void main(String[] args) throws Exception { String iorFile = args[0]; ORB orb = ORB.init( args, null ); POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); poa.the_POAManager().activate(); System.out.println("Server: creating new Adder..."); AdderImp a = new AdderImp(); org.omg.CORBA.Object obj = poa.servant_to_reference( a ); if (iorFile.length() > 0) { System.out.println("Server: saving IOR to file..."); DataOutputStream d = new DataOutputStream( new FileOutputStream(iorFile) ); d.writeUTF(orb.object_to_string( obj )); d.close(); } else { System.out.println("Server: binding my.adder to NameService..."); NamingContextExt nc = NamingContextExtHelper.narrow( orb.resolve_initial_references("NameService") ); nc.bind( nc.to_name("my.adder"), obj ); } System.out.println("Server: ready for requests"); orb.run(); } } shell/iX> cat Client.java // test client for Adder example import org.omg.CORBA.*; import org.omg.CosNaming.*; import java.io.DataInputStream; import java.io.FileInputStream; class Client { public static void main(String[] args) throws Exception { String iorFile = args[0]; ORB orb = ORB.init( args, null ); org.omg.CORBA.Object obj; if (iorFile.length() > 0) { System.out.println("Client: loading IOR from file..."); DataInputStream d = new DataInputStream( new FileInputStream(iorFile) ); String ior = d.readUTF(); d.close(); System.out.println("Client: locating Adder by IOR..."); obj = orb.string_to_object( ior ); } else { System.out.println("Client: locating my.adder in NameService..."); NamingContextExt nc = NamingContextExtHelper.narrow( orb.resolve_initial_references("NameService") ); obj = nc.resolve(nc.to_name("my.adder")); } AdderInt a = AdderIntHelper.narrow( obj ); for (int nextArg=1; nextArg + 1 < args.length; nextArg += 2) { int x = Integer.parseInt( args[nextArg+0] ); int y = Integer.parseInt( args[nextArg+1] ); try { System.out.println( "Client: Adder.add(" + x + "," + y + ") returned: " + a.add(x,y) ); } catch (Negative ex) { System.out.println( "Client: Adder.add(" + x + "," + y + ") threw exception\n" + " Exception was: " + ex + ", Message was: " + ex.msg ); } } System.out.println( "Client: Adder.getTotal() returned: " + a.getTotal() ); } } shell/iX> # notice that the Adder example is similar to what I used for shell/iX> # my experiments with the Voyager ORB, but it has been adjusted shell/iX> # for JacORB and extended with CORBA naming in add'n to IOR shell/iX> ls AdderImp.java Client.java Server.java adder.idl shell/iX> idl adder.idl shell/iX> ls AdderImp.java AdderIntPOA.java NegativeHolder.java AdderInt.java AdderIntPOATie.java Server.java AdderIntHelper.java Client.java _AdderIntStub.java AdderIntHolder.java Negative.java adder.idl AdderIntOperations.java NegativeHelper.java shell/iX> java1c *.java shell/iX> # first we use the IOR approach; as usual, we start the server shell/iX> # in this session and the client in the other session; after the shell/iX> # client test have been completed, the server is aborted again shell/iX> jaco $verbose Server adder.IOR [ POA RootPOA - ready ] Server: creating new Adder... Adder: init [ POA RootPOA - oid: 00 10 00 49 30 11 34 0C 2E 30 - object is activated ] Server: saving IOR to file... Server: ready for requests | shell/iX> # here is the snippet from the client session window... | | shell/iX> cd demo/lars | | shell/iX> ls *.IOR | adder.IOR | | shell/iX> cat -v adder.IOR | ^A\IOR:000000000000001149444c3a4164646572496e743a312e300000000000000003000000000 | 0000031000100000000000c31352e3134302e382e333400eefb00000000001538333739303031333 | 6392f001000493011340c2e300000000000000000000038000101000000000c31352e3134302e382 | e333400eefb000000000015383337393030313336392f001000493011340c2e30000000000000000 | 0000001000000080000000000000000 | | shell/iX> tail -c +3 adder.IOR > temp.ior | | shell/iX> dior -f temp.ior | ------IOR components----- | TypeId : IDL:AdderInt:1.0 | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61179 | Object key : 0x38 33 37 39 30 30 31 33 36 39 2F 00 10 00 49 30 11 34 0C 2E 30 | | Profile Id : TAG_INTERNET_IOP | IIOP Version : 1.1 | Host : 15.xxx.x.xx | Port : 61179 | Object key : 0x38 33 37 39 30 30 31 33 36 39 2F 00 10 00 49 30 11 34 0C 2E 30 | | Profile Id : TAG_MULTIPLE_COMPONENTS | | shell/iX> rm temp.ior | | shell/iX> jaco $verbose Client adder.IOR 3 4 3 -4 4 -4 | Client: loading IOR from file... | Client: locating Adder by IOR... | [ New connection to 15.xxx.x.xx:61179 ] | Client: Adder.add(3,4) returned: 7 | Client: Adder.add(3,-4) threw exception | Exception was: Negative, Message was: Adder.add result was -1 | Client: Adder.add(4,-4) returned: 0 | Client: Adder.getTotal() returned: 6 | | shell/iX> jaco $verbose Client adder.IOR 3 4 3 -4 4 -4 | Client: loading IOR from file... | Client: locating Adder by IOR... | [ New connection to 15.xxx.x.xx:61179 ] | Client: Adder.add(3,4) returned: 7 | Client: Adder.add(3,-4) threw exception | Exception was: Negative, Message was: Adder.add result was -1 | Client: Adder.add(4,-4) returned: 0 | Client: Adder.getTotal() returned: 12 | | shell/iX> # and a third test by running the Client from a PC (IOR via Samba) >| D:\adder>type ..\jaco.bat >| @echo off >| set orbdef=-Dorg.omg.CORBA.ORBClass=jacorb.orb.ORB >| set singletondef=-Dorg.omg.CORBA.ORBSingletonClass=jacorb.orb.ORBSingleton >| set namesdef=-Djacorb.NameServerURL=file:/ns.ior >| set verbose=-Djacorb.verbosity=2 >| java %orbdef% %singletondef% %namesdef% %verbose% %* >| >| D:\adder>jaco Client F:\corba\jacorb1_1\demo\lars\adder.IOR 1 2 3 -4 -5 6 >| Client: loading IOR from file... >| Client: locating Adder by IOR... >| [ New connection to 15.xxx.x.xx:61179 ] >| Client: Adder.add(1,2) returned: 3 >| Client: Adder.add(3,-4) threw exception >| Exception was: Negative, Message was: Adder.add result was -1 >| Client: Adder.add(-5,6) returned: 1 >| Client: Adder.getTotal() returned: 15 >| >| D:\adder>rem -- back in the server window we can see additonal messages... [ Accepted connection from 127.0.0.1:61187 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=3,4 Adder: add returns sum 7 [ POA RootPOA - rid: 1 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=4,-4 Adder: add returns sum 0 [ POA RootPOA - rid: 3 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: getTotal - process request ] Adder: getTotal returns 6 [ Closing connection to 127.0.0.1:61187 ] [ Accepted connection from 127.0.0.1:61189 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=3,4 Adder: add returns sum 7 [ POA RootPOA - rid: 1 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=4,-4 Adder: add returns sum 0 [ POA RootPOA - rid: 3 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: getTotal - process request ] Adder: getTotal returns 12 [ Closing connection to 127.0.0.1:61189 ] [ Accepted connection from 15.xxx.xxx.xxx:2724 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=1,2 Adder: add returns sum 3 [ POA RootPOA - rid: 1 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: add - process request ] Adder: add, in=-5,6 Adder: add returns sum 1 [ POA RootPOA - rid: 3 oid: 00 10 00 49 30 11 34 0C 2E 30 opname: getTotal - process request ] Adder: getTotal returns 15 [ Closing connection to 15.xxx.xxx.xxx:2724 ] :abort Program aborted per user request. (CIERR 989) : :shell ,40960000,40960000 shell/iX> cd J* shell/iX> . useful shell/iX> # after aborting the server, we start it in "Corba Naming mode" shell/iX> # by running Server and passing an empty IOR filename as parameter shell/iX> # as usual, we run a few Client tests and then abort the server shell/iX> cd demo/lars shell/iX> rm adder.IOR shell/iX> jaco $verbose Server "" [ POA RootPOA - ready ] Server: creating new Adder... Adder: init [ POA RootPOA - oid: 00 10 00 49 32 24 19 29 14 3F - object is activated ] Server: binding my.adder to NameService... [ New connection to 15.xxx.x.xx:61158 ] Server: ready for requests | shell/iX> # here are the snippets from the session window starting the client | shell/iX> # as with the server, the program gets an empty name in place of the | shell/iX> # IOR filename parameter to tell it to use CORBA naming instead | | shell/iX> jaco $verbose Client "" 3 4 3 -4 4 -4 | Client: locating my.adder in NameService... | [ New connection to 15.xxx.x.xx:61158 ] | [ New connection to 15.xxx.x.xx:61191 ] | Client: Adder.add(3,4) returned: 7 | Client: Adder.add(3,-4) threw exception | Exception was: Negative, Message was: Adder.add result was -1 | Client: Adder.add(4,-4) returned: 0 | Client: Adder.getTotal() returned: 6 | | shell/iX> jaco $verbose Client "" 3 4 3 -4 4 -4 | Client: locating my.adder in NameService... | [ New connection to 15.xxx.x.xx:61158 ] | [ New connection to 15.xxx.x.xx:61191 ] | Client: Adder.add(3,4) returned: 7 | Client: Adder.add(3,-4) threw exception | Exception was: Negative, Message was: Adder.add result was -1 | Client: Adder.add(4,-4) returned: 0 | Client: Adder.getTotal() returned: 12 | | shell/iX> # a third run can be performed from my Windows PC as well | | shell/iX> # notice that the PC also needs a copy of the ns.IOR file to | shell/iX> # find its way to the Corba Naming service; we simply copy it | shell/iX> # over from the Samba/iX share (we could also serve it by http | shell/iX> # and adjust the NameServerURL property accordingly)... >| D:\adder>type ..\jaco.bat >| @echo off >| set orbdef=-Dorg.omg.CORBA.ORBClass=jacorb.orb.ORB >| set singletondef=-Dorg.omg.CORBA.ORBSingletonClass=jacorb.orb.ORBSingleton >| set namesdef=-Djacorb.NameServerURL=file:/ns.ior >| set verbose=-Djacorb.verbosity=2 >| java %orbdef% %singletondef% %namesdef% %verbose% %* >| >| D:\adder>copy F:\corba\jacorb1_1\ns.IOR ..\ns.ior >| 1 file(s) copied. >| >| D:\adder>dior ..\ns.ior >| ------IOR components----- >| TypeId : IDL:omg.org/CosNaming/NamingContextExt:1.0 >| Profile Id : TAG_INTERNET_IOP >| IIOP Version : 1.1 >| Host : 15.xxx.x.xx >| Port : 61158 >| Object key : 0x53 74 61 6E 64 61 72 64 4E 53 2F 4E 61 6D 65 53 65 72 76 65 72 >| 2D 50 4F 41 2F 5F 72 6F 6F 74 >| Profile Id : TAG_INTERNET_IOP >| IIOP Version : 1.1 >| Host : 15.xxx.x.xx >| Port : 61158 >| Object key : 0x53 74 61 6E 64 61 72 64 4E 53 2F 4E 61 6D 65 53 65 72 76 65 72 >| 2D 50 4F 41 2F 5F 72 6F 6F 74 >| Profile Id : TAG_MULTIPLE_COMPONENTS >| >| D:\adder>jaco Client "" 1 2 3 -4 -5 6 >| Client: locating my.adder in NameService... >| [ New connection to 15.xxx.x.xx:61158 ] >| [ New connection to 15.xxx.x.xx:61191 ] >| Client: Adder.add(1,2) returned: 3 >| Client: Adder.add(3,-4) threw exception >| Exception was: Negative, Message was: Adder.add result was -1 >| Client: Adder.add(-5,6) returned: 1 >| Client: Adder.getTotal() returned: 15 >| D:\adder> | shell/iX> # so much for the Adder demo, we abort all servers and finish up :-) | | shell/iX> exit | | END OF PROGRAM | :bye [ Accepted connection from 127.0.0.1:61201 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 32 24 19 29 14 3F opname: _non_existent - process request ] [ ServantDelegate: non_existent: return false ] [ Closing connection to 15.xxx.x.xx:61158 ] [ Accepted connection from 127.0.0.1:61202 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=3,4 Adder: add returns sum 7 [ POA RootPOA - rid: 1 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=4,-4 Adder: add returns sum 0 [ POA RootPOA - rid: 3 oid: 00 10 00 49 32 24 19 29 14 3F opname: getTotal - process request ] Adder: getTotal returns 6 [ Closing connection to 127.0.0.1:61202 ] [ POA RootPOA - rid: 1 oid: 00 10 00 49 32 24 19 29 14 3F opname: _non_existent - process request ] [ ServantDelegate: non_existent: return false ] [ Accepted connection from 127.0.0.1:61205 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=3,4 Adder: add returns sum 7 [ POA RootPOA - rid: 1 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=4,-4 Adder: add returns sum 0 [ POA RootPOA - rid: 3 oid: 00 10 00 49 32 24 19 29 14 3F opname: getTotal - process request ] Adder: getTotal returns 12 [ Closing connection to 127.0.0.1:61205 ] [ POA RootPOA - rid: 2 oid: 00 10 00 49 32 24 19 29 14 3F opname: _non_existent - process request ] [ ServantDelegate: non_existent: return false ] [ Accepted connection from 15.xxx.xxx.xxx:2728 ] [ POA RootPOA - rid: 0 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=1,2 Adder: add returns sum 3 [ POA RootPOA - rid: 1 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=3,-4 Adder: add throws exception for sum -1 [ POA RootPOA - rid: 2 oid: 00 10 00 49 32 24 19 29 14 3F opname: add - process request ] Adder: add, in=-5,6 Adder: add returns sum 1 [ POA RootPOA - rid: 3 oid: 00 10 00 49 32 24 19 29 14 3F opname: getTotal - process request ] Adder: getTotal returns 15 [ Closing connection to 15.xxx.xxx.xxx:2728 ] :abort Program aborted per user request. (CIERR 989) :bye