[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.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.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.

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.server.ServerError

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

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.

Other
Exception

Context

java.rmi.server.ServerCloneException

Clone failed



[TOC] [Prev] [Next]

rmi-support@java.Sun.COM
Copyright © 1996 Sun Microsystems, Inc. All rights reserved.