File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes connections error using rmi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "connections error using rmi" Watch "connections error using rmi" New topic

connections error using rmi

Cyntia Russo

Joined: Jul 04, 2013
Posts: 1
hello guys, in first place sorry for my english :/

I need to develop a distribuited application using the RMI tecnology, but I have some issue that stop my implementation work. When I trying to rebind remothe objects the app don't work.
The error that is displayed when I try to run the application is the following:

errore java.rmi.ConnectException: Connection refused to host:; nested exception is: Connection refused: connect

java.rmi.ConnectException: Connection refused to host:; nested exception is: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(
at sun.rmi.transport.tcp.TCPChannel.createConnection(
at sun.rmi.transport.tcp.TCPChannel.newConnection(
at sun.rmi.server.UnicastRef.newCall(
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(
at sio.SIO.main(
Caused by: Connection refused: connect
at Method)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(
... 6 more

the piece that imply this error is:

I know that is possible:
1) use a policy file that must be located in the same directory of the app with this indications:

permission "", "";

2) it's possible modified the project's property (using Netbeans) and indicate this code in the vm options: //"C: etc etc /policy file"

but these equivalent solutions doesn't work, so I decided to use directly the java.policy file that is located in C:\Programmi\Java\jdk1.7.0_21\jre\lib\security. In this file I adding this code:
grant {
permission "localhost:1024-65535","accept, connect, listen, resolve";
permission "localhost:80", "connect";
permission "localhost:1099", "resolve,connect,accept,listen";

but I cannot bind a remothe object with the local registry, and I don't understand the motivation of this problem
someone can help me?

I agree. Here's the link:
subject: connections error using rmi
It's not a secret anymore!