Re: Problem when starting remote rmiregistry service using ssh

Qiang Wei <[email protected]> Sun, 7 Oct 2007 21:23:18 -0700
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Thank you Chris, Esmond and Gregg. I finally solved the problem. It was
caused exactly as Chris mentioned. After I updated the ".bashrc" file (add
the Sun Java 1.5 bin path and set the JAVA_HOME), the problem was gone.
 Before the update, it seemed that the shell used the default GNU Java
as Esmond pointed
out, which caused the exceptions.

Best, Sean


On 10/7/07, Christopher De Vries <[email protected]> wrote:
>
> I think the culprit might be the shell. When you log in using ssh, you
> run a login shell. If you use the bash shell the ".profile" or
> ".bash_profile" is loaded when you log in, but if you are just
> executing a command remotely, such as you are doing you do not start a
> login shell and bash instead reads the ".bashrc" file during
> initialization.
>
> The problem may be that only your .profile file includes the correct
> initialization information. Try putting "source ~/.profile" in your
> .bashrc and see if that fixes it.
>
> Chris
>
> On 10/5/07, Qiang Wei <[email protected]> wrote:
> > * Hi all,
> >
> > I want to start the rmiregistry on a remote server (assuming its IP is
> > 192.168.1.1) by using the following command:
> >
> >
> >
> > $ ssh 192.168.1.1 "rmiregistry &"
> >
> >
> >
> > But  I always get the following exceptions:
> >
> >
> >
> > Exception in thread "main" java.lang.ExceptionInInitializerError
> >
> >    at java.lang.Class.initializeClass(libgcj.so.7rh)
> >
> >    at gnu.java.rmi.server.UnicastConnectionManager.getInstance(
> libgcj.so.7rh
> > )
> >
> >    at gnu.java.rmi.server.UnicastServerRef.<init>(libgcj.so.7rh)
> >
> >    at gnu.java.rmi.registry.RegistryImpl.<init>(libgcj.so.7rh)
> >
> >    at java.rmi.registry.LocateRegistry.createRegistry(libgcj.so.7rh)
> >
> >    at java.rmi.registry.LocateRegistry.createRegistry(libgcj.so.7rh)
> >
> >    at gnu.java.rmi.registry.RegistryImpl.main(libgcj.so.7rh)
> >
> > Caused by: java.lang.NullPointerException
> >
> >    at java.net.InetAddress.getHostAddress(libgcj.so.7rh)
> >
> >    at gnu.java.rmi.server.UnicastConnectionManager.<clinit>(
> libgcj.so.7rh)
> >
> >    at java.lang.Class.initializeClass(libgcj.so.7rh)
> >
> >    ...6 more
> >
> >
> >
> > However, If I first login the machine using ssh and then run rmiregistry
> > locally, it starts well.
> >
> >
> >
> > Anybody know why this happens? Any hint on solving this problem is
> highly
> > appreciated.
> >
> >
> >
> > Best, Sean
> > *
> >
> >
> ===========================================================================
> > To unsubscribe, send email to [email protected] and include in the
> body
> > of the message "signoff RMI-USERS".  For general help, send email to
> > [email protected] and include in the body of the message "help".
> >
> > For a list of frequently asked RMI questions please refer to:
> > http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
> >
> > To view past RMI-USERS postings, please see:
> > http://archives.java.sun.com/archives/rmi-users.html
> >
>

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html