Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI deployed on Apache/Tomcat  RSS feed

ralph michelsen
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello javaranchers
I 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 "".
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:; nested exception is: Connection refused: connect Connection refused: connect
at Method)
at 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.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at dk.chatrmi.ChatImpl.registerChatter(
at dk.chatrmi.ChatImpl.init(
at Source)
at 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
Ralph Michelsen
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!