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);
}
}