Logo F2FInterview

RMI Interview Questions

Q   |   QA

UnkownHostException error can come for many reasons. To find out first there is a need to know the network's name service that is having a fully-qualified hostname recognized by RMI host. The possible problems that might come are:

  • There is a possibility of having misconfigured DHCP servers that allows fully-qualified domain name of RMI server machines. RMI client in this case try to access the outside server's DHCP domain that will make it unavailable for the server.
  • There is a possibility of having the error due to WINS server. It is possible that only registered users might not be reachable by hosts.
  • There is a possibility of having a firewall that is blocking the RMI client and server side requests. If the server resides inside the firewall and the client outside then the client won't be able to make any remote calls to the server that is inside due to the firewall. 

HTTP-Tunneling is a method that requires no setup and works within the firewall environment. It allows the handling of HTTP through proxy server and doesn't allow regular outbound TCP connections. If the RMI fails to make any connection specially SOCKS then connection is made through an intended server that allow the HTTP proxy server to be configured. This will allow the request to be passed through the proxy server one by one. The forms of HTTP-tunneling are http-to-port: where the RMI attempt to use HTTP POST request using a URL that will be directed at the hostname and port number of the server that is given. If the proxy accepts the URL it will forward a POST request to listen to RMI server that will remove the request of the name. There is an http-to-cgi tunneling that will consists of the requests and allow the proxy request to be binded to their defined port numbers.

RMI uses a runtime client that a virtual machine detects of the remote object that is not referenced locally. It notify the server in came of any disconnections and this way the server can be updated by the object's set. The garbage collector that is distributed associate an address with each client remote object reference. It also renew the remote objects while the client still consists of the references. This mechanism will allow the abnormal termination of the clients so that server can hold the remote objects that are not referenced using the message that are stopped running. The function System.exit() can be invoked for abnormal termination, as it doesn't allow the RMI runtime to send a proper messages to the server. This function will terminate the client virtual machine and will keep the remote references that will be cleaned up before exiting. The other functions that are used for this are:

System.gc();
System.runFinalization();

RMI is a distributed object system that provides and enable to easily develop the distributed Java applications. It is easier to develop applications using the RMI method then using the sockets. It doesn't require any protocol for design that makes it less prone to error for the tasks performed by it. RMI is allows the local method to be called from a local class file and the remote methods are interpreted and are sent back to the callers. The CORBA also having the same features that are seen in RMI. It is a platform and language independent architecture that can be run on any platform. It can be located from anywhere on the network and can be used in any language that has a mapping with IDL (Interface definition language). The objects of this are specified with interfaces that are specified in the interface language.

There are different terms that are used in RMI that helps in calling the remote servers and allow an easy to use terminology to be created:

  • Remote object: it is an object that is provided on another computer to request the object by sending a message to the object to the remote servers.
  • Server object: it is an object of the server side that receive the request and respond to the request of the client in success or failure.
  • rmiregistry: is the registry that keeps the look ups of all the objects in a list by given name. This registry consists the list of all the components that are given in it.
  • Rmic: is a compiler for RMI object. After creating the object the compiler compiles the object and it will generate the actual code that is to be transferred to the client side. 

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: