MethodInterceptor for accessing RMI services
from JNDI. Typically used for RMI-IIOP but can also be used for EJB home objects
(for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup,
this accessor also performs narrowing through PortableRemoteObject.
With conventional RMI services, this invoker is typically used with the RMI
service interface. Alternatively, this invoker can also proxy a remote RMI service
with a matching non-RMI business interface, i.e. an interface that mirrors the RMI
service methods but does not declare RemoteExceptions. In the latter case,
RemoteExceptions thrown by the RMI stub will automatically get converted to
Spring's unchecked RemoteAccessException.
The JNDI environment can be specified as "jndiEnvironment" property,
or be configured in a jndi.properties file or as system properties.
public void setRefreshStubOnConnectFailure(boolean refreshStubOnConnectFailure)
Set whether to refresh the RMI stub on connect failure.
Default is "false".
Can be turned on to allow for hot restart of the RMI server.
If a cached RMI stub throws an RMI exception that indicates a
remote connect failure, a fresh proxy will be fetched and the
invocation will be retried.
public void setExposeAccessContext(boolean exposeAccessContext)
Set whether to expose the JNDI environment context for all access to the target
RMI stub, i.e. for all method invocations on the exposed object reference.
Default is "false", i.e. to only expose the JNDI context for object lookup.
Switch this flag to "true" in order to expose the JNDI environment (including
the authorization context) for each RMI invocation, as needed by WebLogic
for RMI stubs with authorization requirements.
public void afterPropertiesSet()
Return the RMI stub to use. Called for each invocation.
The default implementation returns the stub created on initialization,
if any. Else, it invokes lookupStub() to get a new stub for
each invocation. This can be overridden in subclasses, for example in
order to cache a stub for a given amount of time before recreating it,
or to test the stub whether it is still alive.
the RMI stub to use for an invocation
javax.naming.NamingException - if stub creation failed
Create a new RemoteInvocation object for the given AOP method invocation.
The default implementation delegates to the configured
This can be overridden in subclasses in order to provide custom RemoteInvocation
subclasses, containing additional invocation parameters (e.g. user credentials).
Note that it is preferable to build a custom RemoteInvocationFactory
as a reusable strategy, instead of overriding this method.
methodInvocation - the current AOP method invocation