avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hammant <Paul_Hamm...@yahoo.com>
Subject Re: How do I get original block instance from BlockEvent?
Date Mon, 14 Jan 2002 08:11:52 GMT
Peter, Eung-Ju,

>On Mon, 14 Jan 2002 15:51, Eung-ju Park wrote:
>
>>I write RMIfication, RMIficationListener and simple demo.
>>I run RMIHelloWorldServer. I meet StubNotFoundException.
>>RMIfication find proxy wrapped version block instance...
>>How do I solve this problem?
>>
>
>At the moment it is not possible for one Block to get access to another Block 
>directly unless it is passed to them. This is to make sure the Blocks are not 
>used after they have been disposed or in manners unexpected by developers. 
>
>I will have a look at this a bit to see if there is a good solution to it all.
>

That might be useful for some apps where speed across block boundaries 
is key.

Eung-Ju's error is :

Caused by: java.rmi.StubNotFoundException: Stub class not found: 
$Proxy1_Stub; nested exception is:
        java.lang.ClassNotFoundException: $Proxy1_Stub
        at sun.rmi.server.RemoteProxy.getStub(RemoteProxy.java:101)
        at sun.rmi.server.RemoteProxy.getStub(RemoteProxy.java:58)
        at 
sun.rmi.server.UnicastServerRef.setSkeleton(UnicastServerRef.java:182)
        at 
sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
        at 
sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:132)
        at 
java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
        at 
java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:181)
        at 
java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:158)
        at 
org.apache.avalon.cornerstone.blocks.rmification.DefaultRMIfication.publish(DefaultRMIfication.java:71)

I think if service interface were just an interface and an RMI adapter 
were also written for the service then it could work well as is.

// this is the service that Phoenix makes a block for
public interface HelloWorldServer {
    String sayHello( final String yourName )
}

// remote client uses this
public interface RMIHelloWorldServer extends Remote {
    String sayHello( final String yourName ) throws RemoteException 
throws RemoteException;
}

// The RMIPublisher block knows the name of this class as it is passed in.  
// It instantiates it using reflection and publishes it through 
exportObject.....
public class RMIHelloWorldServerAdapter implements RMIHelloWorldServer {
    private HelloWorldServer mHelloWorldServer;
    public RMIHelloWorldServerAdapter(HelloWorldServer helloWorldServer) {
        mHelloWorldServer = helloWorldServer
    }
    String sayHello( final String yourName ) throws RemoteException 
throws RemoteException {
        mHelloWorldServer.sayHello(yourName);
    }
}

Regards,

- Paul H


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message