模块 java.rmi
 java.rmi

类 RemoteException

所有已实现的接口:
Serializable
已知子类:
AccessException , ConnectException , ConnectIOException , ExportException , MarshalException , NoSuchObjectException , ServerError , ServerException , ServerRuntimeException , SkeletonMismatchException , SkeletonNotFoundException , StubNotFoundException , UnexpectedException , UnknownHostException , UnmarshalException

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

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

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

自从:
1.1
参见:
  • 字段详细信息

    • 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()
      返回详细消息,包括来自此异常原因的消息(如果有)。
      重写:
      getMessage 在类 Throwable
      返回:
      详细信息
    • getCause

      public Throwable  getCause()
      返回此异常的原因。此方法返回 detail 字段的值。
      重写:
      getCause 在类 Throwable
      返回:
      原因,可能是 null
      自从:
      1.4