Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

starting rmiregistry programmatically

357 views
Skip to first unread message

Richard Robinson

unread,
Jun 26, 2001, 4:25:28 PM6/26/01
to
Hello,

I want to start the rmiregistry in the background, and then leave it
there. Ultimately I want this to be done programmatically. I presume I
should be able to do it like this (manually):

===> strqsh cmd( 'rmiregistry &' )

But that hangs. As if it doesn't recognize the "&" symbol. Escaping
the "&" as "\&" doesn't seem to help, as the rmiregistry then
interprets it as a bad port assignment.

Surely there must be a way to start the rmiregistry in the background,
without having to keep a QSH session open interactively. Any ideas?

-- Richard Robinson

Gabriel Fröhlich

unread,
Jun 27, 2001, 3:11:09 AM6/27/01
to
It is possible to start the rmiregistry from java:

try
{
System.out.println("createRegistry");
registry = java.rmi.registry.LocateRegistry.createRegistry(port);
}
catch (Throwable e) {System.out.println("\n\nregistry not
created");registry=null;}

if (registry==null)
{
System.out.println("getRegistry");
registry = java.rmi.registry.LocateRegistry.getRegistry(port);
}


Richard Robinson schrieb:

Richard Robinson

unread,
Jun 27, 2001, 3:30:54 PM6/27/01
to
Gabriel,

Thank you for your reply. I'm relatively new at RMI and I have learned
something from you about the java.rmi.registry.* package.

But I'm still where I started. For it is really an AS/400 QSH or CL or
Job question, I guess. And that is: How does one start,
non-interactively, a Java job in the background.

I *can* start the registry via QSH interactively, with "rmiregistry
&", with the "&" putting the registry in the background. Reading Java
For AS/400 documentation, and for QSH in particular, it looks like
this trick may have been a happy side-effect, "&" purportedly there
for linking asynchronously commands together.

Problem is that if my AS/400 server reboots (as may happen someday,
say, for a brown out or black out; or after a CUM PTF install), then I
don't want to have to remember (or, rather, forget) to start the RMI
registry. I'd prefer to set this up programmatically.

Any way you (or anyone else) know how to start, non-interactively, a
Java program in the AS/400 "background"?

-- Richard Robinson


Gabriel Fröhlich <gabriel.fr...@netway.at> wrote in message news:<3B39870C...@netway.at>...

Gabriel Fröhlich

unread,
Jun 28, 2001, 2:51:35 AM6/28/01
to
Hello Richard,

there are two possibilities to do that job. The first one is to write an OS/400 CL-Program where you can use
the commands QSH or JAVA. This program can be used as an autostartjob of any subsystem or started with SBMJOB
from QSTRUP program. In this case it not necessary to use '&' in the shell-command. But you have to prepare
the environment for java (e.g. CLASSPATH, QIBM_MULTI_THREADED) either in the CL pgm with ADDENVVAR or in the
shell script.
The second possibility would be to write an java-servlet which starts everything what you need. Then you have
to configure a HTTP server instance with WebSphere that starts your servlet automatically.

Gabriel Fröhlich

Richard Robinson schrieb:

0 new messages