Re: I got some problems when using use activation mechanism of RMI



I change the class ProductImpl as you said.
public class ProductImpl extends Activatable implements Product {

private String name;

private static final long serialVersionUID = 6613571299445532659L;

public ProductImpl(ActivationID id , MarshalledObject object)throws
IOException, ClassNotFoundException{
super(id , 0);
name=(String)object.get();
System.out.println("marshalledobject");
}

public String getDescription() throws RemoteException {
return "I am a " + name + ". Buy me!";
}
}

But I get another exception:
java.rmi.UnmarshalException: Error unmarshaling return header; nested
exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.server.ActivatableRef.invoke(Unknown Source)
at ProductImpl_Stub.getDescription(Unknown Source)
at ProductClient.main(ProductClient.java:20)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(Unknown Source)
... 5 more

EJP wrote:
Zheng Da wrote:

public class ProductImpl extends UnicastRemoteObject implements Product

You must either change this to 'extends Activatable implements Product',
in which case you should replace the following quoted line by super(id,
0); or else restore the following quoted line as it is:

//Activatable.exportObject(this , id , 0);

There may be other problems.

.