This question already has answers here:
RMI cannot connect to remote server
(2 answers)
Closed 9 years ago.
I can't seem to connect 2 machines using RMI. To make sure there wasn't something wrong with my code I copied the simple example from wikipedia (http://en.wikipedia.org/wiki/Java_remote_method_invocation) and I edited the code to print out a simple int.
I tried giving all permissions and turning all the firewalls off and I still get this error:
java.rmi.ConnectException: Connection refused to host 55.229.xx.xxx; nested
exception is:java.net.ConnectException: Connection timed out: connect
I've been trying to do this for the past 3 days and I still can't seem to get past basic configuration problems.
The Problem could be your RMI server is sending back its local address, instead of WAN address.
System.setProperty("java.rmi.server.hostname", *host IP*);
also take a look at security policies regarding RMI:
http://docs.oracle.com/javase/tutorial/rmi/running.html
Check your firewall settings on your aws instance
RMI is running on 1099 port by default as i remember.
Related
This question already has answers here:
RMI lookup works but method invocation not
(2 answers)
Closed 3 years ago.
So I have a very basic client-server program running on my local lan network.
The program consists in the server being a permanent listener, adding every client who connects to his ip to a list of observers and updating them every 5 seconds (Client Extends UnicastRemoteObject).
The problem is that I don't know why the client creates a reference using an unknown ip address.
This is what I usually get from the client, if I type System.out.println(this):
RmiClient[UnicastServerRef [liveRef: [endpoint:[192.168.56.1:64199](local),objID:[32218df3:16acc934a0a:-7fff, 8241015111525045915]]]]
I did some research and I found that ip address belongs to my VirtualBox Host-Only Newtork interface, so when I disable this I get the correct infos:
RmiClient[UnicastServerRef [liveRef: [endpoint:[192.168.1.3:64307](local),objID:[1b156947:16acc999fa5:-7fff, 6095931207093481175]]]]
Which is the correct ip of this machine on my lan.
My question is how do I make this work without permanent disabling the interface?
Also if I set server and client on different machines, I get a RemoteException when the server tries to update the clients because it tries to contact 192.168.56.1 and obviously fails.
Solved! The problem consisted in the Client extending UnicastRemoteObject.
Apparently I had to set the property java.rmi.server.hostname in both client and server applications, but in the client that wasn't working because of the extension.
So I managed to solve by eliminating the extension and adding the following code:
UnicastRemoteObject.exportObject(this, port);
This way the propery works correctly on the client.
This question already has answers here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
(51 answers)
Closed 4 years ago.
I am getting an error (exceptions) while deploying my project. Some time ago the project was working but now it is not working. Please tell me a solution to get rid of this.
You dont provide any code so i ll answer about the error. Link Failure usually means that there was a problem trying to communicate with a service. This means, it seems like your jsp couldn't connect to your database on a connection level. Do you have your DB instance listening on localhost? Do you have firewalls in place that's preventing communication between your jsp and your DB instance? Have you checked the internet connection? The link? Maybe its usefull to check this Solving a "communications link failure" with JDBC and MySQL
It seems you forgot to include MySql connector into library. Please check if MySql connector is available in your project library.
As no code is provided, I just go trough troubleshooting from your GlassFish application server. I suppose you are using connection pool to connect to DB. Are you able to ping your connection pool? You might try via admin console or command line :
asadmin> ping-connection-pool myPool
This question already has answers here:
How can I access my localhost from my Android device?
(44 answers)
Closed 6 years ago.
I have a pretty dumb question.
I have a Java server running on my computer, which can be visited on localhost:8080. How do I visit it through my mobile phone (in local network, connected to Wi-Fi)?
I tried to open the port or even turn off the firewall.
The path Ip address:port doesn't seem to work.
Is there something I am missing or forgot to do?
its running on your local machine not on your local network/wifi, what you'll have to do is find your computer IP and use it with the current port if you are on the same network.
in general its bad practice to test server programs like that and its highly recommended to use an Apache server and upload it to a cloud then just run it from there.
This question already has answers here:
Connecting to a VPN without installation of client software
(3 answers)
Closed 8 years ago.
I am trying to write a client-server program in Java. There are a lot of working examples with using localhost as IP of the server. I am using VPN and running client and server codes on different computers in same network. But client can not connect to this server when I provide ip given after running VPN (such as 12.123.45.32). I generally get timeout error even if I set it to a large number. But if I use local IP such as 192.168.1.10, it works and connects.
I also wonder if there is a way for client and server to communicate with using server's public IP (without any VPN).
Any suggestions?
Thanks..
There is no problem in accessing a server through public ip or domain name. Only problem can be address renewal. Other than that you need to make sure the correct ports are forwarded in your router / firewall.
Are you using sockets or RMI?
Sockets shouldn't be a problem, but RMI require you to setup a SecurityManager or something like that. Honestly I have never gotten RMI to work over internet; I have stuck with sockets.
I wouldn't bother with VPN at all. Way too unstable imho. I only use VPN if I'm unable to setup company router for access.
This question already has answers here:
How to get the list of IP addresses in a LAN?
(2 answers)
Closed 9 years ago.
Recently, I created a client/server application by java, they connect is fine, but when i test it in my school network, it can not work fine anymore, so, i need some code that return all IP of Lan network into an array so that i can put it in a JComboBox, the code should be non-blocking so it cannot hang my application.
P/S: I have been try brute-force method (like other answer) to get all IPs but it just hang my application and really not reliable.
Anyway, thank for your help.
~Best Regard and have a nice day
it can not work fine anymore, so, i need some code that return all IP
of Lan network into an array so that i can put it in a JComboBox
Why would you need these IPs????
Problem could be:
Either you bind to localhost and when you deploy in different machines you can't connect. So don't bind to localhost.
Or there is a firewall. So unblock the firewall.
Or there is no route between the machines. Can you even ping it? (but if there is a firewall it will not ping also).
So you can troubleshoot it.