Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

RMI deployed on Apache/Tomcat

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
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic