JavaTM 2 Platform
Standard Ed. 6

java.rmi
类 RemoteException

java.lang.Object
  继承者 java.lang.Throwable
      继承者 java.lang.Exception
          继承者 java.io.IOException
              继承者 java.rmi.RemoteException
所有已实现的接口:
Serializable
直接已知子类:
AccessException, ActivateFailedException, ActivityCompletedException, ActivityRequiredException, ConnectException, ConnectIOException, ExportException, InvalidActivityException, InvalidTransactionException, MarshalException, NoSuchObjectException, ServerError, ServerException, ServerRuntimeException, SkeletonMismatchException, SkeletonNotFoundException, StubNotFoundException, TransactionRequiredException, TransactionRolledbackException, UnexpectedException, UnknownHostException, UnmarshalException

public class RemoteException
extends IOException

RemoteException 是许多与通信相关的异常的通用超类,这些异常可能会在执行远程方法调用期间发生。远程接口(扩展 java.rmi.Remote 的接口)的每个方法必须在其 throws 子句中列出 RemoteException

从版本 1.4 开始,已对此异常作出改进,以符合通用异常链机制。可以在构造时提供并通过公共 detail 字段访问的“包装的远程异常”现在称为 cause,并可通过 Throwable.getCause() 方法以及前述的“遗留字段”访问。

RemoteException 的实例上调用方法 Throwable.initCause(Throwable) 始终抛出 IllegalStateException

从以下版本开始:
JDK1.1
另请参见:
序列化表格

字段摘要
 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
 

字段详细信息

detail

public Throwable detail
远程异常的原因。

此字段早于通用异常链设施。Throwable.getCause() 方法现在是获取此信息的首选方法。

构造方法详细信息

RemoteException

public RemoteException()
构造一个 RemoteException


RemoteException

public RemoteException(String s)
构造带指定详细消息的 RemoteException

参数:
s - 详细消息

RemoteException

public RemoteException(String s,
                       Throwable cause)
构造带指定详细消息和原因的 RemoteException。此构造方法将 detail 字段设置为指定的 Throwable

参数:
s - 详细信息
cause - 原因
方法详细信息

getMessage

public String getMessage()
返回此异常的详细消息,包括来自原因(如果有)方面的消息。

覆盖:
Throwable 中的 getMessage
返回:
详细消息

getCause

public Throwable getCause()
返回此异常的原因。此方法返回 detail 字段的值。

覆盖:
Throwable 中的 getCause
返回:
原因,它可以为 null
从以下版本开始:
1.4

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only