Hi, I just finished implementing the RMI mechanism to realize the remote data access. When I tried to run it, a "Data class missing no-argument constructor" exception popped up from RMI client side. The followings are what I did, 1. Defined a RMI Client interface: public interface RMIClientIF extends Serializable 2. Defined a RMI Client class by extending Data class. public class RMIClient extends Data implements RMIClientIF 3. Then I created a RMIClient (client_) and forward it to server to get the necessary data: ... client_ = new RMIClient(); ... this.remoteAgt_ = (RMIServerIF) Naming.lookup(rmi_object_name_); ... When it goes to the next line, Data() will be called from server side. remoteAgt_.getFieldInfo(client_); In RMIClient() constructor I used super(strDataBaseName); to call Data class constructor, but why the server use no-argument constructor?? If you have any idea about this, could you please give me some hint? Thank you for your time. May
I am not sure what you are trying to do here, but I can tell you why it is calling the default constructor. You have a class RMIClient which is Serializable, but it extends a class (Data) which is not. When the Java de-serializes an object it will attempt to call default constructors on any super classes which are not serializable. Basicly, for a class to be serializable there are restrictions on its memember variables (they must be primitives, transitive, or implement serilaizable) and there are restrictions on the super class. It must be serializable or have a default constructor. I somewhat doubt if you want to make Data serializable, so you likly want to re-think your design.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why RMI server called no-argument constructor of Data class??