|
Marco_Van_Maris@ept.lu wrote: > > Hi there. > > I am running V4R5 and I am trying desperately to start the RMIREGISTRY on my > AS/400. > Typing RMIREGISTRY in QSH doesn't give me a result, I don't get my prompt back > nothing happens. > Can anybody help me and tell me how I start RMI ? You can do this in two ways: 1) Start it in the background (QShell), e.g. "rmiregistry &". 2) Start it from your program running on the AS/400, e.g. /** * Program entry point. Sets a security manager, instantiates the class, * starts an RMI registry, and binds this instance to it. * @param argv[] Arguments (none used). */ public static void main (String argv[]) { RMIMethodsImpl RMIMethods = null; Registry reg = null; //////////////////////////// // set a security manager: System.setSecurityManager (new RMISecurityManager()); /////////////////////////// // set up server methods: try { System.out.println ("instantiating RMIMethodsImpl object..."); RMIMethods = new RMIMethodsImpl (); } catch (Exception e) { System.out.println ("can't instantiate RMIMethodsImpl object!"); System.out.println (e.getMessage()); System.exit (1); } ////////////////////////////////////////////////////////// // create and export a standard RMI registry: System.out.println ("creating standard RMI registry..."); try { reg = LocateRegistry.createRegistry (1099); } catch (Exception e) { System.out.println ("Can't create registry: " + e.getMessage()); System.exit (1); } /////////////////////////////////////////////////// // bind ourselves with the registry we've created System.out.println ("binding with RMI registry..."); try { Thread.sleep (1000); } catch (Exception e) { // no-op } try { reg.rebind ("RMIMethods", RMIMethods); System.out.println ("RMIMethods bound in registry, " + "awaiting client requests."); } catch (Exception e) { System.out.println ("Can't bind with registry: " + e.getMessage()); System.exit (1); } // (note that Java keeps RMI servers running on another thread...) } -- ____________________________________________________________ Glenn Holmer gholmer@weycogroup.com Programmer/Analyst phone: 414.908.1809 Weyco Group, Inc. fax: 414.908.1601 +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.