RMI Server on Unix machine - java

I have an RMI server and RMI client programs, when I execute RMI server on unix machine, and RMI client on Windows machine, I am getting
java.rmi.ConnectException: Connection
refused to host: ; nested exception is: java.net.ConnectException:
Connection refused: connect at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at the client side. I am able to execute on server and client on windows system but the server on linux is not working.
I searched using google, but I am unable to find the reason and fix.
I would appreciate your help.
Thank you in advance!

Referring the url
java.rmi.ConnectException: Connection refused to host: 127.0.1.1;
I added a line to /etc/hosts file and it works, but I am accessing the host using the IP address in my client program.
I did not understand why do we need to add a line to the /etc/hosts file.
Any comments. Thank You!.

Related

Failed to connect remote VM. Connection timed out(Failed to connect remote VM. Connection timed out)

Launch error: Failed to connect to remote VM. Connection timed out
Project -SDK
Connection type - Standard (Socket Attach)
Host: IP address of the SAP server
Port: 8080
There is nowhere like enough information in your question to identify the actual cause of your problem (or the fix), but problems like this typically occur because:
you are using the wrong hostname or IP address when connecting to the server
the server is off
a firewall is blocking your access to the server
there is something wrong with the network.
Hope this will give you some ideas about what to look for.

How to setup Java RMI RMI connection between docker containers in different hosts

I have the a docker container (Name CON1) running in the host A, this container is a java RMI server listening on port 1099. I also have another the container (Name CON2) running a java RMI client in the host B. When I telnet CON1 from CON2 using the RMI port 1099 it works fine:
$ telnet 172.30.34.74 1099
Trying 172.30.34.74...
Connected to 172.30.34.74.
Escape character is '^]'.
But when I try to connect through the java RMI client the connection is refused and the error message shows a different IP address for CON1.
java.rmi.ConnectException: Connection refused to host: 172.18.0.2; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
Although I use 172.30.34.74 to make the lookop in the RMI client code, the error message shows other IP address (172.18.0.2). When I run the RMI server and the RMI client outside a docker container it works good.
What can I check to solve this situation?
I implemented a solution:
Add to the java command line to start the RMI server the argument -Djava.rmi.server.hostname=HOST_IP. Where host HOST_IP is the host IP.
Set the container's network_mode to host. This way, the container would take same IP as host.

Could not connect to SMTP host error in my local only

I am getting this error while trying to send mail through java mail. It used to work for me, but recently I switched to jdk7 and glassfish 3.1.2. I tried to switch it back to jdk6 also but it's not working anymore, here is the error I'm getting:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.illumina.com, port: 25;
nested exception is:
java.net.SocketException: Permission denied: connect
Telnet and ping to this server is fine. Its working from other systems. Only my local setup is throwing this error.
Any ideas?

Can't connect two remote hosts in Java RMI

My server's code looks like:
Registry r = java.rmi.registry.LocateRegistry.createRegistry(1399);
r.rebind("Chat", new IRC());
and my client's code is
IRCInterface remoteObject = (IRCInterface) Naming.lookup("rmi://localhost:1399/Chat");
String history = remoteObject.read();
on the localhost it works correctly, but I can't connect two remote computers (hosts).
I've turned off all firewalls.
What's wrong?
The console outputs:
Error: java.rmi.ConnectException: Connection refused to host: 150.254.79.20; nested exception is:
java.net.ConnectException: Connection timed out: connect
Naming.lookup("rmi://localhost:1399/Chat");
localhost in above lookup should be replaced with remotehost IP (or) machine name. Otherwise lookup happens on only local machine.

Unable to connect to ftp server java

I should be able to successfully send and receive file to/from FTP server.
But then, no changes occurred in the code and I started getting this :
Error: java.net.ConnectException: Connection timed out: connect
What I am doing is:
FTPClient ftp = new FTPClient();
ftp.connect( IPADDRESS of FTP server);
connect() is giving this execption. I am not understanding the cause for it.
The error message is telling you that the OS's attempt to connect to the server timed out. This typically means that:
the remote server has dropped off the network, or
something (e.g. a firewall) is "black holing" packets sent to the server on the FTP port.
Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the connection was refused remotely (e.g., no process is listening on the remote address/port).
Source: JavaDoc.

Categories

Resources