Announcement Announcement Module
No announcement yet.
Exporting RMI service that implements Remote - Feature needed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exporting RMI service that implements Remote - Feature needed

    Currently (Spring 2.5.1) has some magic in RmiBasedExporter that exposes an RMI service either as a regular RMI object or a Spring RmiInvocationWrapper. This logic is based on whether the service implements the java.rmi.Remote interface.

    Under normal exposure, this behaviour is ok. But when further functionality is desired, such as using RemoteInvocationFactory (example - to use Acegi's ContextPropagatingRemoteInvocationFactory), then the magic of RmiBasedExporter gets in the way.

    It would be nice to be able to instruct Spring to export using the RmiInvocationWrapper despite the fact that the original service object does implement Remote. I think having the default behavior act this way is alright, but explicit configuration should be possible.

    This should be an easy feature to add in RmiBasedExporter, e.g., add a new property such as 'forceUseRmiInvocationWrapper'.

    In my case, my interface is being used elsewhere and MUST implement Remote.

    See also:

    Here's the current logic (or 'magic') in RmiBasedExporter:

    protected Remote getObjectToExport() {
        // determine remote object
        if (getService() instanceof Remote &&
                ((getServiceInterface() == null) || Remote.class.isAssignableFrom(getServiceInterface()))) {
            // conventional RMI service
            return (Remote) getService();
        else {
            // RMI invoker
            if (logger.isDebugEnabled()) {
                logger.debug("RMI service [" + getService() + "] is an RMI invoker");
            return new RmiInvocationWrapper(getProxyForService(), this);

    I have a workaround if anyone needs it in the meantime.