001/* 002 * Copyright 2002-2008 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.remoting; 018 019import org.springframework.core.NestedRuntimeException; 020 021/** 022 * Generic remote access exception. A service proxy for any remoting 023 * protocol should throw this exception or subclasses of it, in order 024 * to transparently expose a plain Java business interface. 025 * 026 * <p>When using conforming proxies, switching the actual remoting protocol 027 * e.g. from Hessian to Burlap does not affect client code. Clients work 028 * with a plain natural Java business interface that the service exposes. 029 * A client object simply receives an implementation for the interface that 030 * it needs via a bean reference, like it does for a local bean as well. 031 * 032 * <p>A client may catch RemoteAccessException if it wants to, but as 033 * remote access errors are typically unrecoverable, it will probably let 034 * such exceptions propagate to a higher level that handles them generically. 035 * In this case, the client code doesn't show any signs of being involved in 036 * remote access, as there aren't any remoting-specific dependencies. 037 * 038 * <p>Even when switching from a remote service proxy to a local implementation 039 * of the same interface, this amounts to just a matter of configuration. Obviously, 040 * the client code should be somewhat aware that it <i>might be working</i> 041 * against a remote service, for example in terms of repeated method calls that 042 * cause unnecessary roundtrips etc. However, it doesn't have to be aware whether 043 * it is <i>actually working</i> against a remote service or a local implementation, 044 * or with which remoting protocol it is working under the hood. 045 * 046 * @author Juergen Hoeller 047 * @since 14.05.2003 048 */ 049public class RemoteAccessException extends NestedRuntimeException { 050 051 /** Use serialVersionUID from Spring 1.2 for interoperability */ 052 private static final long serialVersionUID = -4906825139312227864L; 053 054 055 /** 056 * Constructor for RemoteAccessException. 057 * @param msg the detail message 058 */ 059 public RemoteAccessException(String msg) { 060 super(msg); 061 } 062 063 /** 064 * Constructor for RemoteAccessException. 065 * @param msg the detail message 066 * @param cause the root cause (usually from using an underlying 067 * remoting API such as RMI) 068 */ 069 public RemoteAccessException(String msg, Throwable cause) { 070 super(msg, cause); 071 } 072 073}