RMI on Apache web server
Hello SUN ForumI have a question regarding RMI. I have created a small chatprogram "applet" which runs on an Apache web server. In order to test this program i have modified the java.policy to receave all incoming requests "java.security.AllPermission".
This is a sample of the servercode:
//create registry on port 5050
Registry registry = LocateRegistry.createRegistry(5050);
registry.rebind("ChatServerImpl", chatServer);
This is a sample of the client code:
//lookup the server's remote object
chatServer = (ChatServer)
Naming.lookup ("rmi://localhost:5050/ChatServerImpl");
Now!! The above code runs fine. The problem is when a change the host "localhost" to run on my own registred domain, and deploy it on my own apache webserver I get the following error:
java.rmi.ConnectException: Connection refused to host: 80.62.99.224; nested exception is:
java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<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.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at dk.chatrmi.ChatImpl.registerChatter(ChatImpl.java:82)
at dk.chatrmi.ChatImpl.init(ChatImpl.java:67)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The web server actually starts the applet, but when the client "lookup" is performed it throws the above mentioned exception.
Could it maybe have anything to do with the fact, that I have not informed the server which host to bind the service to? All I have done which the server is to create a registry on port 5050. This works fine on "localhost", but might in fact cause problems on other hosts. What do you think?
Please help a frustrated developer
regards
Ralph