Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

can't connect to localhost?

843793Apr 28 2006 — edited Nov 10 2009
Hi all,
I'm getting the following error when trying to run a program I wrote. The program compiles fine, but gives me the following errors when I try to run it. I'm fairly new to java so any ideas about what could be causing the problem would be helpful. I'm running this on Windows. Do I need to disable any firewall settings or something or will RMI handle it?


C:\Program Files\Java\jdk1.5.0_06\bin>java MSserverApplication
Exception in thread "main" java.rmi.ConnectException: Connection refused to host
: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
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.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at MSserverApplication.main(MSserverApplication.java:14)
Caused by: java.net.ConnectException: Connection refused: connect
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:366)
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(RMIDirect
SocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
... 6 more


import java.rmi.Naming;

public class MSserverApplication
{
	public static void main(String args[]) throws Exception
	{
		MSserver server = new MSserverImpl();	
		
		String serverObjectName = "rmi://localhost/MSserver";
		Naming.rebind(serverObjectName, server);
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 8 2009
Added on Apr 28 2006
4 comments
321 views