The TShopGoods.java is like:
public class TShopGoods extends ShopGoods {
}
The ShopGoods class is like:
public class ShopGoods implements IsSerializable {
protected int id = 0;
protected String shopId = "";
protected String goodsTitle = "";
protected int categoryId = 0;
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Id=" + id);
sb.append(",ShopId=" + shopId);
sb.append(",GoodsTitle=" + goodsTitle);
sb.append(",CategoryId=" + categoryId);
return sb.toString();
}
public int getCategoryId() {
return categoryId;
}
public void setCategoryId(int categoryId) {
this.categoryId = categoryId;
}
public int getId() {
return id;
}
public void setId(int goodsId) {
this.id = goodsId;
}
public String getGoodsTitle() {
return goodsTitle;
}
public void setGoodsTitle(String goodsTitle) {
this.goodsTitle = goodsTitle;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
}
can anyone help me ?
Hi Miguel,
Thanks for your email. What is most instereted is : i checked out a
older version from svn server, which has definately passed the
compiling and basic running(otherwise, I won't commit). and run it
again, RPC failed. I have used GWT since it was published, and have
been developing app on GWT, no big problem was found until last
weekend. I really don't know what i did.
My comment is in followed:
Miguel Méndez wrote:
> Hello Feng,
>
> From your first email, it appears that your client is receiving a packet
> from the server that contains a type that cannot be deserialized when it is
> interacting with your myproject.protocol.ILogin service. What method within
> the ILogin service are you calling? What types does it return?
public interface ILogin extends RemoteService {
Account login(byte type, String id, String passwd) throws
CheckedException;
}
public abstract class Account implements IsSerializable {
protected String id = "";
protected String displayName = "";
protected String password = "";
public Account() {}
public Account(Account account) {
set(account);
}
.......//some getter() and setter()
}
And another two classes extend from Account class.
public class Shop extends Account {
protected String companyName = "";
protected String brand = "";
...... //some getter() and setter()
}
>
> The error message in the dialog box is somewhat of a mystery. The string
> "Really unknown error!!!" does not appear anywhere in our source. Could
> this be your error message? Also, we would not normally popup a dialog box
> when an error is encountered.
sorry, it is in my code.
>
> Lastly, I put together a dummy service using your ShopGoods and TShopGoods
> from your second email. I was able to send that back and forth between the
> client and the server. Is there some piece that is missing?
Yes, I just copy a part of code which i thought is enough.
The TShopGoods should be:
public class TShopGoods extends ShopGoods implements ITable {
public void read(java.sql.ResultSet rs) throws SQLException {
id = rs.getInt("Id");
shopId = rs.getString("ShopId");
goodsTitle = rs.getString("GoodsTitle");
categoryId = rs.getInt("CategoryId");
}
}
public class ShopGoods implements IsSerializable {
protected int id = 0;
protected String shopId = "";
protected String goodsTitle = "";
protected int categoryId = 0;
......//some getter() and setter()
}
public interface ITable {
void read(java.sql.ResultSet rs) throws SQLException;
> ------=_Part_30679_10701683.1156168257316
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 3742
>
> Hello Feng,<br><br>From your first email, it appears that your client is receiving a packet from the server that contains a type that cannot be deserialized when it is interacting with your myproject.protocol.ILogin service. What method within the ILogin service are you calling? What types does it return?
> <br><br><div style="direction: ltr;"></div>The error message in the dialog box is somewhat of a mystery. The string "Really unknown error!!!" does not appear anywhere in our source. Could this be your error message? Also, we would not normally popup a dialog box when an error is encountered.
> <br><br>Lastly, I put together a dummy service using your ShopGoods and TShopGoods from your second email. I was able to send that back and forth between the client and the server. Is there some piece that is missing?<br>
> <br>I hope this helps,<br><br><div><span class="gmail_quote">On 8/19/06, <b class="gmail_sendername">Feng Jiang</b> <<a href="mailto: Feng.A...@gmail.com">Feng.A...@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> <br>The TShopGoods.java is like:<br>public class TShopGoods extends ShopGoods {<br>}<br><br>The ShopGoods class is like:<br>public class ShopGoods implements IsSerializable {<br><br> protected int id = 0;<br><br> protected String shopId = "";
> <br><br> protected String goodsTitle = "";<br><br> protected int categoryId = 0;<br><br> public String toString() {<br> StringBuffer sb = new StringBuffer();<br> sb.append("Id=" + id);
> <br> sb.append(",ShopId=" + shopId);<br> sb.append(",GoodsTitle=" + goodsTitle);<br> sb.append(",CategoryId=" + categoryId);<br> return sb.toString();<br> }<br>
> <br> public int getCategoryId() {<br> return categoryId;<br> }<br><br> public void setCategoryId(int categoryId) {<br> this.categoryId = categoryId;<br> }<br><br> public int getId() {<br> return id;
> <br> }<br><br> public void setId(int goodsId) {<br> <a href=" http://this.id">this.id</a> = goodsId;<br> }<br><br> public String getGoodsTitle() {<br> return goodsTitle;<br> }<br><br> public void setGoodsTitle(String goodsTitle) {
> <br> this.goodsTitle = goodsTitle;<br> }<br><br> public String getShopId() {<br> return shopId;<br> }<br><br> public void setShopId(String shopId) {<br> this.shopId = shopId;<br> }<br><br>
> }<br><br><br>can anyone help me ?<br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Miguel
>
> ------=_Part_30679_10701683.1156168257316--
Hi Miguel,
TShopGoods is not in the client package, otherwise the source code
cannot be compiled. The TShopGoods is located in server package, and
SQLException is definately caught in the server side if it happens
(actually any exception is caught before returned back to client site).
Based on the developer guider, i can do everything in the server side.
The implementation of ILogin interface is like:
public Account login(byte type, String id, String passwd) throws
CheckedException {
if (type == Constant.SHOP)
return loginAsShop(id, passwd); //it successfully returned
a instance of a subclass of Account
else if (type == Constant.PERSON)
return loginAsPerson(id, passwd);
else
throw new CheckedException("Unknown login type.");
}
I debug the host-mode(not web mode) in eclipse, and the ILoginImpl
successfully returns an Account instance. but client side got a
SerializationException as my frist email.
In one word, the server side returned a correct instance, and client
got a Exception.
Thanks alot,
Feng
first thanks for the very quick answer!!!
I tried to make Bean Serialize but it got me an other error
i wanna know if what i wanna to do is possible!! Is there an other way to solve the issue 23?
"Probably the class is not considered serializable "
is there a way to make it considered?
thankz again
Regards
Tiago2007/4/4, Miguel Méndez < mme...@google.com>:Hi Tiago,
It seems like this would be related to issue 23. Probably the class is not considered serializable and so client side code throws and runs into issue 23.
Did you add the @gwt.typeArgs javadoc annotation to service method's return type? Check out the following link for how to do this: http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.SerializableTypes.html
Let me know if you are still having problems.On 4/4/07, JavaNight <tiago...@gmail.com> wrote:Hello
My name is Tiago, Im from Brasil!!
I just started to use GWT, and by the way, did amazing things with
less effort. The most greatfull thing i found about it..was the
numbers of errors that it got, till now it was ZERO! But now i had
this Javascript error..then i realized that it could be my class.. and
reading your post i saw that maybe its the problem. Let me explain.
1 - I have a very simple class(bean), and it is in myproject.client
package.
2- In my Service class method, i return a Collection of this
Class(bean). And the error occurs in my CLIENT.
3- When i change the return of my service method to return a
Collection of String class instead of the Bean class, it works just
fine!!!!!!!!
ERROR: java.lang.RuntimeException: Checked exception thrown into
JavaScript
(web mode behavior may differ)
I wanna know.. cant i return my client class from the server?? or
maybe im doing something wrong!!!
Sorry for bother, and thanks in advice!!!
Tiago
--
Miguel
Hello
i followed the link you send me and it work
i missed the link in your first reply, i was very busy here..sorry!! but today i read and made my class implements IsSerializable... it worked
thankz for your attention, for your fast reply and for the very good work you are doing with GWT!!