File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

connections error using rmi

Cyntia Russo
Greenhorn

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: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect

java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:177)
at sio.SIO.main(SIO.java:34)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 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:

grant
{
permission java.security.AllPermission "", "";
};


or
2) it's possible modified the project's property (using Netbeans) and indicate this code in the vm options: //-DJava.security.manager -Djava.security.policy="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 java.net.SocketPermission "localhost:1024-65535","accept, connect, listen, resolve";
permission java.net.SocketPermission "localhost:80", "connect";
permission java.net.SocketPermission "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: http://aspose.com/file-tools
 
subject: connections error using rmi