站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java Remote Method Invocation: 4 - Client Interfaces - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

CONTENTS | PREV | NEXT Java Remote Method Invocation


4.2 The RemoteException Class

The class java.rmi.RemoteException is the common superclass of a number of communication-related exceptions that may occur during the execution of a remote method call. Each method of a remote interface, an interface, must list RemoteException (or one of its superclasses such as java.io.IOException or java.lang.Exception) in its throws clause.

package java.rmi;
public class RemoteException extends java.io.IOException
{    
	public Throwable detail;
	public RemoteException();
	public RemoteException(String s);
	public RemoteException(String s, Throwable ex);
	public String getMessage();
	public void printStackTrace();
	public void printStackTrace(java.io.PrintStream ps);
	public void printStackTrace(java.io.PrintWriter pw);
}


A RemoteException can be constructed with a detail message, s, and a nested exception, ex (a Throwable). Typically, the nested exception, ex, specified as a parameter in the third form of the constructor, is the underlying I/O exception that occurred during an RMI call.

The getMessage method returns the detail message of the exception, including the message from the nested exception (if any).

The printStackTrace methods are overridden from the class java.lang.Throwable to print out the stack trace of the nested exception.



CONTENTS | PREV | NEXT
Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.