java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.io.IOException
java.rmi.RemoteException
public class RemoteException
RemoteException 是许多与通信相关的异常的通用超类,这些异常可能会在执行远程方法调用期间发生。远程接口(扩展 java.rmi.Remote 的接口)的每个方法必须在其 throws 子句中列出 RemoteException。
从版本 1.4 开始,已对此异常作出改进,以符合通用异常链机制。可以在构造时提供并通过公共 detail 字段访问的“包装的远程异常”现在称为 cause,并可通过 Throwable.getCause() 方法以及前述的“遗留字段”访问。
在 RemoteException 的实例上调用方法 Throwable.initCause(Throwable) 始终抛出 IllegalStateException。
| 字段摘要 | |
|---|---|
Throwable |
detail 远程异常的原因。 |
| 构造方法摘要 | |
|---|---|
RemoteException() 构造一个 RemoteException。 |
|
RemoteException(String s) 构造带指定详细消息的 RemoteException。 |
|
RemoteException(String s, Throwable cause) 构造带指定详细消息和原因的 RemoteException。 |
|
| 方法摘要 | |
|---|---|
Throwable |
getCause() 返回此异常的原因。 |
String |
getMessage() 返回此异常的详细消息,包括来自原因(如果有)方面的消息。 |
| 从类 java.lang.Throwable 继承的方法 |
|---|
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public Throwable detail
此字段早于通用异常链设施。Throwable.getCause() 方法现在是获取此信息的首选方法。
| 构造方法详细信息 |
|---|
public RemoteException()
RemoteException。
public RemoteException(String s)
RemoteException。
s - 详细消息
public RemoteException(String s, Throwable cause)
RemoteException。此构造方法将
detail 字段设置为指定的
Throwable。
s - 详细信息
cause - 原因
| 方法详细信息 |
|---|
public String getMessage()
Throwable 中的
getMessage
public Throwable getCause()