Rmi working only on localhost

Marco Iora <[email protected]>
Newsgroups gmane.comp.java.sun.rmi
Message-ID <LISTSERV%[email protected]>
I've followed some tutorials i've found on the net, but I can get RMI to
work only on localhost. I'm using Sun Jdk 1.5.0.01 on two linux-based box.

I report the problems I get running the rmi example from
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html

I have done mkdir to create coherent directory with packages example.hello
and put in ~/example/hello the three .java files (Hello.java Server.java
Client.java.
Then i make the class files with a "javac example/hello/*.java"
(I've done things up to here to both the server and the client machines)

Then i start the rmiregistry and launch "java example.hello.Server" on the
first machine.
It says: Server ready

When i start "java example.hello.Client 192.168.10.46" (that is the ip of
the first machine) on the second machine i get these exceptions:

Client exception: java.rmi.ConnectException: Connection refused to host:
127.0.0.1; nested exception is:
        java.net.ConnectException: Connection refused
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested
exception is:
        java.net.ConnectException: Connection refused
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
        at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
        at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
        at
java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
        at $Proxy0.sayHello(Unknown Source)
        at example.hello.Client.main(Client.java:53)
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
        at java.net.Socket.connect(Socket.java:507)
        at java.net.Socket.connect(Socket.java:457)
        at java.net.Socket.<init>(Socket.java:365)
        at java.net.Socket.<init>(Socket.java:178)
        at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
        at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
        ... 7 more

Please help me to solve this problem!!!
Thank you all.

===========================================================================
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.