I think it's fine to have constructors with arguments (so long as you also
have a zero-argument constructor), but, yes, Kontakt needs to be
serializable too.

kathrin

On Wed, Mar 31, 2010 at 2:41 PM, Sean <[email protected]> wrote:

> Don't have a constructor with arguments, only use Set/Gets.
>
> What's a Kontakt? Is that serializable?
>
> Fix the constructor and verify Kontakt is serializable and it should
> work.
>
>
>
>
>
> On Mar 31, 10:43 am, Johannes Stein <[email protected]>
> wrote:
> > Hey,
> >
> > ive got a problem and im searching for hours to find a solution.
> > My problem is the following:
> >
> > I have a little RPC-Service which returns as a result a "Domain"-
> > Object (Own custom-class).
> > But this Domain-Object could not be serialized, though i have made
> > this "Domain"-class serializable with
> > com.google.gwt.user.client.rpc.IsSerializable.
> >
> > Im using GWT SDK 2.01 and getting the following compiling error:
> >
> > [ERROR] com.google.gwt.core.client.JavaScriptObject is not assignable
> > to 'com.google.gwt.user.client.rpc.IsSerializable' or
> > 'java.io.Serializable' nor does it have a custom field serializer
> > (reached via com.vostokdomains.kis.client.objetcs.Domain)
> >
> >  [ERROR] com.google.gwt.core.client.JavaScriptObject has no available
> > instantiable subtypes. (reached via
> > com.vostokdomains.kis.client.objetcs.Domain)
> >
> > I hope you can help me out!!
> > --------------------------------------------
> > Enclosed some code-snippets:
> >
> > package com.vostokdomains.kis.client.objetcs;
> >
> > import java.util.Date;
> >
> > import com.google.gwt.i18n.client.DateTimeFormat;
> > import com.google.gwt.user.client.rpc.IsSerializable;
> >
> > ========== Domain-Object============
> >
> > public class Domain implements Comparable<Domain>, IsSerializable{
> >
> >         private String adresse;
> >         private String tld;
> >         private Date create;
> >         private Date next;
> >         private int laufzeit;
> >         private double preis;
> >
> >         private Kontakt registrar;
> >         private Kontakt admin;
> >         private Kontakt tech;
> >         private Kontakt owner;
> >
> >         private String namesever1;
> >         private String nameserver2;
> >         private String records;
> >
> >         Domain(){
> >
> >         }
> >
> >         public Domain(String adresse, String tld, int tag, int monat, int
> > jahr, Kontakt kontakt) {
> >
> >                 DateTimeFormat fmt =
> DateTimeFormat.getFormat("dd.MM.yyy");
> >
> >                 this.setRegistrar(new Kontakt("Keine Angabe"));
> >                 this.adresse=adresse;
> >                 this.tld=tld;
> >                 this.owner=kontakt;
> >                         this.next=fmt.parse((tag+"."+monat+"."+jahr));
> >
> >                 return;
> >
> >         }
> >
> >         public Domain(String adresse, String tld, Kontakt kontakt){
> >                 this.setRegistrar(new Kontakt("Keine Angabe"));
> >                 this.adresse=adresse;
> >                 this.tld=tld;
> >                 this.owner=kontakt;
> >                 this.next=new Date();
> >         }
> >
> > [....]
> >
> > ================= DatabaseService ====================
> >
> > public class DatabaseServiceImpl extends RemoteServiceServlet
> > implements
> >                 DatabaseService {
> >
> >         /**
> >          *
> >          */
> >         private static final long serialVersionUID = 1L;
> >
> >         public Domain getDomains() {
> >
> >                 DBConnection conn = new DBConnection();
> >                 conn.connect();
> >                 Connection dbconn = conn.getConnection();
> >                 System.out.print("TEST");
> >                 Domain d = null;
> >
> >                 try {
> >                         ResultSet rs = null;
> >                         Statement stm = dbconn.createStatement();
> >                         System.out.print("STATEMENT");
> >                         stm.execute("SELECT * FROM domains");
> >                         rs = stm.getResultSet();
> >
> >                         rs.next() ;
> >                                 Kontakt k = new Kontakt(rs.getString(2));
> >                                 d = new Domain(rs.getString(3), "tld",
> k);
> >
> >                 } catch (SQLException e) {
> >                         // TODO Auto-generated catch block
> >                         e.printStackTrace();
> >                 }
> >                         return d;
> >
> >         }
> >
> > }
> >
> > ======================== RPC Call ========================
> >
> > public class Kis implements EntryPoint {
> >
> >         @Override
> >         public void onModuleLoad() {
> >
> >                 DatabaseServiceAsync rpc;
> >                 rpc = (DatabaseServiceAsync)
> GWT.create(DatabaseService.class);
> >                 ServiceDefTarget target = (ServiceDefTarget) rpc;
> >                 String moduleRelativeURL = GWT.getModuleBaseURL() +
> > "DatabaseServiceImpl";
> >                 target.setServiceEntryPoint(moduleRelativeURL);
> >                 /*
> >                 test.add();
> >                 RootPanel.get().add(test.vpanel);*/
> >
> >                 rpc.getDomains(new AsyncCallback<Domain>() {
> >
> >                 public void onFailure(Throwable caught) {
> >
> >                   Window.alert("Übertragung fehlgeschlagen!" );
> >                 }
> >
> >                 public void onSuccess(Domain rs) {
> >
> >                         //Expiration ex = new Expiration();
> >                         //ex.create(rs,0);
> >                         System.out.print(rs.getAdresse());
> >                         //RootPanel.get().add(ex.vpanel);
> >
> >                         }
> >                         }
> >                 );
> >
> >         }
> >
> > }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to