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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

RMI deployed on Apache/Tomcat

 
Greenhorn
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 "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 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
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic