my dog learned polymorphism
The moose likes Threads and Synchronization and the fly likes Error in lookup: java.rmi.ConnectException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Error in lookup: java.rmi.ConnectException" Watch "Error in lookup: java.rmi.ConnectException" New topic

Error in lookup: java.rmi.ConnectException

neg yazdi

Joined: Sep 09, 2009
Posts: 1
I got this error when I run my client side program in a project using RMI:

Error in lookup: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: Connection refused: connect

I do not know what is the problem
if I add " System.setSecurityManager(new RMISecurityManager()); " to the server side I got the following error

Exception in thread "main" access denied ( connect,resolve)
at Source)
at Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at Source)
at Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at business.ServerMain.main(

line 30 is:
// put the local instance in the registry
Naming.rebind("SAMPLE-SERVER", Server);

please help me as soon as possible...

I agree. Here's the link:
subject: Error in lookup: java.rmi.ConnectException
It's not a secret anymore!