[TOC] [Prev] [Next]

Exceptions In RMI


Topics:

Exceptions During Remote Object Export

When a remote object class is created that extends UnicastRemoteObject, the object is exported, meaning it can receive calls from external Java virtual machines and can be passed in an RMI call as either a parameter or return value. An object can either be exported on an anonymous port or on a specified port. For objects not extended from UnicastRemoteObject, the java.rmi.server.UnicastRemoteObject.exportObject method is used to explicitly export the object.
Exception

Context

java.rmi.StubNotFoundException

  1. Class of stub not found.
  2. Name collision with class of same name as stub leads to:
    • Stub can't be instantiated.
    • Stub not of correct class.
  3. Bad URL due to wrong codebase.
  4. Stub not of correct class.

java.rmi.server.SkeletonNotFoundException

  1. Class of skeleton not found.
  2. Name collision with class of same name as skeleton leads to:
    • Skeleton can't be instantiated.
    • Skeleton not of correct class.
  3. Bad URL due to wrong codebase.
  4. Skeleton not of correct class.

java.rmi.server.ExportException

The port is in use by another VM.

Exceptions During RMI Call
Exception

Context

java.rmi.UnknownHostException

Unknown host.

java.rmi.ConnectException

Connection refused to host.

java.rmi.ConnectIOException

I/O error creating connection.

java.rmi.MarshalException

I/O error marshaling transport header, marshaling call header or marshaling arguments.

java.rmi.NoSuchObjectException

Attempt to invoke a method on an object that is no longer available.

java.rmi.StubNotFoundException

Remote object not exported.

Exceptions or Errors During Return
Exception

Context

java.rmi.UnmarshalException

  1. Corrupted stream leads to I/O or protocol error:
    • Unmarshaling return header.
    • Checking return type.
    • Checking return code.
    • Unmarshaling return.
  2. Return value class not found.

java.rmi.UnexpectedException

An exception not in the method signature occurred, including runtime exceptions on the client. This exception object contains the underlying exception.

java.rmi.ServerError

Any error that occurs while the server is executing a remote method.

java.rmi.ServerException

Any remote exception that occurs while the server is executing a remote method. See Section A.3.1 for examples.

java.rmi.ServerRuntimeException

Any runtime exception that occurs while the server is executing a method, even if the exception is in the method signature. This exception object contains the underlying exception.

Possible Causes of java.rmi.ServerException

These are the underlying exceptions which can occur on the server when the server is itself executing a remote method invocation. These exceptions are wrapped in a java.rmi.ServerException, that is the java.rmi.ServerException contains the original exception for the client to extract. These exceptions are wrapped by ServerException so that the client will know that its own remote method invocation on the server did not fail, but that a secondary remote method invocation made by the server failed.
Exception

Context

java.rmi.server.SkeletonMismatchException

Hash mismatch of stub and skeleton.

java.rmi.UnmarshalException

I/O error unmarshaling call header. I/O error unmarshaling arguments.

java.rmi.MarshalException

Protocol error marshaling return.

java.rmi.RemoteException

Method number out of range due to corrupted stream.

Naming Exceptions

The following table lists the exceptions specified in methods of the java.rmi.Naming class and the java.rmi.registry.Registry interface.
Exception

Context

java.rmi.AccessException

Operation disallowed. The registry restricts bind, rebind, and unbind to the same host. The lookup operation can originate from any host.

java.rmi.AlreadyBoundException

Attempt to bind a name that is already bound.

java.rmi.NotBoundException

Attempt to look up a name that is not bound.

java.rmi.UnknownHostException

Attempt to contact a registry on an unknown host.

Other
Exception

Context

java.rmi.RMISecurityException

A security exception that is thrown by the RMISecurityManager.

java.rmi.server.ServerCloneException

Clone failed.

java.rmi.server.ServerNotActiveException

Attempt to get the client host via the RemoteServer.getClientHost method when the remote server is not executing in a remote method.

java.rmi.server.SocketSecurityException

Attempt to export object on an illegal port.



[TOC] [Prev] [Next]

rmi-support@java.Sun.COM

Copyright © 1996 Sun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, CA 94043-1100 USA. All rights reserved.