HostedModeException doing a RPC call

12 views
Skip to first unread message

xavybb

unread,
Apr 5, 2008, 7:46:10 AM4/5/08
to Google Web Toolkit
Hi,

I'm having troubles to communicate GWT with SEAM using RPC.

This's my DTO:

package org.app.client;

import java.io.Serializable;


public class SignInStatus implements Serializable {

private String SessionID = null;
private String DisplayError = null;
private String UserName = null;

public SignInStatus() {
}

public void setSessionID(String SessionID) {
this.SessionID = SessionID;
}

public void setDisplayError(String DisplayError) {
this.DisplayError = DisplayError;
}

public void setUserName(String UserName) {
this.UserName = UserName;
}

public String getSessionID() {
return this.SessionID;
}

public String getDisplayError() {
return this.DisplayError;
}

public String getUserName() {
return this.UserName;
}

}

And when I do a RPC call in hosted mode I get this exception:

[WARN] Exception thrown into JavaScript
com.google.gwt.dev.shell.HostedModeException:
invokeNativeInteger(@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()):
JavaScript undefined, expected java.lang.Integer
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
481)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
270)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
137)
at
org.macrosoft.client.MyService_TypeSerializer.deserialize(transient
source for org.macrosoft.client.MyService_TypeSerializer:53)
at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:
94)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:
61)
at org.macrosoft.client.MyService_Proxy$1.onCompletionImpl(transient
source for org.macrosoft.client.MyService_Proxy:60)
at org.macrosoft.client.MyService_Proxy
$1.onCompletionAndCatch(transient source for
org.macrosoft.client.MyService_Proxy:46)
at org.macrosoft.client.MyService_Proxy$1.onCompletion(transient
source for org.macrosoft.client.MyService_Proxy:40)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)

Can anybody explain me why, and from where, is GWT trying to read an
int?

Thx in advance for your help

xavybb

unread,
Apr 8, 2008, 1:13:04 PM4/8/08
to Google Web Toolkit
I'm debugging GWT code, and the execution throws an
InvocationTargetException, in public void invoke(int jsthisInt, int[]
jsargsInt, int returnValueInt) method of MethodDispatch class. And
then throws:
com.google.gwt.dev.shell.HostedModeException:
invokeNativeInteger(@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()):
JavaScript undefined, expected java.lang.Integer

Maybe my DTO object is not correctly tranfered?

xavybb

unread,
Apr 9, 2008, 12:52:02 PM4/9/08
to Google Web Toolkit
I tried to do the RPC call returning only a String and it works fine.

Any suggestion?

Sumit Chandel

unread,
Apr 9, 2008, 5:44:40 PM4/9/08
to Google-We...@googlegroups.com
Hi xavybb,

A couple of things to double-check that have caused similar behaviour to what you're describing here.

1) Make sure you gwt-servlet JAR isn't out of sync with the rest of your GWT application JARs. That is, if you have recently upgraded to a new version of GWT, make sure you have updated the gwt-servlet JARs for both classpaths in your GWT compiler and hosted mode shell scripts. Also, if you're using hosted mode with the -noserver option, ensure that the server you're using has been updated to use the latest gwt-servlet JAR file.

2) Delete the gwt-cache directory and restart the hosted mode browser. It's possible that there is some stale content from previous versions of your DTOs (or other resources) living in the gwt-cache directory that are confusing the hosted mode browser.

Double-check these two points and let us know how it goes.

Hope that helps,
-Sumit Chandel


On Wed, Apr 9, 2008 at 12:52 PM, xavybb <xav...@gmail.com> wrote:

I tried to do the RPC call returning only a String and it works fine.

Any suggestion?






--
Join us at Google's biggest developer event of the year
May 28-29, San Francisco
http://code.google.com/events/io

xavybb

unread,
Apr 10, 2008, 12:21:14 PM4/10/08
to Google Web Toolkit
I'm running a Jboss server.

I started the application with GWT 1.4.60 and I doesn't upgraded the
application.

I tried to remove the .gwt-cache directory but the error persists.

I tried to implement the IsSerializable interface following this post:
http://jira.jboss.org/jira/browse/JBSEAM-2305.

And the error persists. I can't understand why GWT is trying to read
an int from my VTO.

Thanks for your interest Sumit.

gregor

unread,
Apr 11, 2008, 6:19:16 AM4/11/08
to Google Web Toolkit
Hi,

I seem to remember getting something very weird like this myself a few
months ago. What I did was simply write a new class (different name,
same code) and the problem went away for some reason. Have you tried
this?

regards
gregor

xavybb

unread,
Apr 11, 2008, 1:01:31 PM4/11/08
to Google Web Toolkit
I tried it with no result, the applicattion throws same exception.

gregor

unread,
Apr 11, 2008, 10:11:51 PM4/11/08
to Google Web Toolkit
Have you tried it with IsSerializable?

Miguel Méndez

unread,
Apr 14, 2008, 7:55:07 AM4/14/08
to Google-We...@googlegroups.com
This looks like a corrupt stream since the stream expects there to be an integer but there isn't one.  This could be caused by the data being encoding.  Could you try making all of the strings be "" and see if the problem still occurs?  This would help determine whether the problem is the data or the way that the object was encoded.
--
Miguel

xavybb

unread,
Apr 12, 2008, 3:39:45 AM4/12/08
to Google Web Toolkit
Yes, I tried it too

xavybb

unread,
Apr 17, 2008, 1:30:37 PM4/17/08
to Google Web Toolkit
I'm having same exception setting "" to the string attributes of my
Object. I'm searching in the Internet for this problem and I can find
anything.

Thanks for your interest.

gregor

unread,
Apr 17, 2008, 4:03:17 PM4/17/08
to Google Web Toolkit
Can you reproduce this problem with a fresh class?

xavybb

unread,
Apr 18, 2008, 2:04:15 AM4/18/08
to Google Web Toolkit
Yes i tried it too and problem persists. I created a new class with a
diferent name and the exception was the same.

Miguel Méndez

unread,
Apr 21, 2008, 10:03:00 AM4/21/08
to Google-We...@googlegroups.com
I must admit that I am at a loss at this point.  It looks like the client is getting a response back from the server but the stream is somehow corrupted.  The only thing that I could think to try might be to see if you can isolate the problem when seam is not being used -- that may or may-not shed light.
--
Miguel

Ricardo Campos

unread,
May 22, 2008, 10:14:17 PM5/22/08
to Google Web Toolkit
Hello there!

It seems that the JavaBeans must implement
com.google.gwt.user.client.rpc.IsSerializable so they can be
integrated correctly with their JavaScript versions.
So, in this case, the declaration of your class should be:


***
import com.google.gwt.user.client.rpc.IsSerializable;
***

public class SignInStatus implements Serializable, IsSerializable {

***

}


That should do it! The documentetion from Google says that it should
be one interface or another, but it only worked for me when I
implemented IsSerializable. And there seems to be no problem leaving
both interfaces implemented (wich is good)! Remember that the child
objects of the class should also follow the same pattern...
Read more here:
http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.html#SerializableTypes

Peace!!!!
> invokeNativeInteger(@com.google.gwt.user.client.rpc.impl.ClientSerializatio­nStreamReader::readInt()):
> JavaScript undefined, expected java.lang.Integer
>         at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> 481)
>         at
> com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
> 270)
>         at
> com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.jav­a:
> 137)
>         at
> org.macrosoft.client.MyService_TypeSerializer.deserialize(transient
> source for org.macrosoft.client.MyService_TypeSerializer:53)
>         at
> com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deseria­lize(ClientSerializationStreamReader.java:
> 94)
>         at
> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readO­bject(AbstractSerializationStreamReader.java:

xavybb

unread,
May 24, 2008, 7:18:44 AM5/24/08
to Google Web Toolkit
I tried it with no luck, my DTO now look like this:

package org.app.client;

import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;


public class SignInStatus implements Serializable, IsSerializable {

private String SessionID;
private String DisplayError;
private String UserName;

public SignInStatus() {
}

public void setSessionID(String SessionID) {
this.SessionID = SessionID;
}

public void setDisplayError(String DisplayError) {
this.DisplayError = DisplayError;
}

public void setUserName(String UserName) {
this.UserName = UserName;
}

public String getSessionID() {
return this.SessionID;
}

public String getDisplayError() {
return this.DisplayError;
}

public String getUserName() {
return this.UserName;
}

}

And I'm still receiving the HostedModeException... Thanks for your
interest anyway.

On 23 mayo, 04:14, Ricardo Campos <ricardocam...@gmail.com> wrote:
> Hello there!
>
> It seems that the JavaBeans must implement
> com.google.gwt.user.client.rpc.IsSerializable so they can be
> integrated correctly with their JavaScript versions.
> So, in this case, the declaration of your class should be:
>
> ***
> import com.google.gwt.user.client.rpc.IsSerializable;
> ***
>
> public class SignInStatus implements Serializable, IsSerializable {
>
> ***
>
> }
>
> That should do it! The documentetion from Google says that it should
> be one interface or another, but it only worked for me when I
> implemented IsSerializable. And there seems to be no problem leaving
> both interfaces implemented (wich is good)! Remember that the child
> objects of the class should also follow the same pattern...
> Read more here:http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...

xavybb

unread,
May 24, 2008, 8:41:42 AM5/24/08
to Google Web Toolkit
I tried it with no luck, my DTO now look like this:

package org.app.client;

import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;


public class SignInStatus implements Serializable, IsSerializable {

private String SessionID;
private String DisplayError;
private String UserName;

public SignInStatus() {
}

public void setSessionID(String SessionID) {
this.SessionID = SessionID;
}

public void setDisplayError(String DisplayError) {
this.DisplayError = DisplayError;
}

public void setUserName(String UserName) {
this.UserName = UserName;
}

public String getSessionID() {
return this.SessionID;
}

public String getDisplayError() {
return this.DisplayError;
}

public String getUserName() {
return this.UserName;
}

}

And I'm still receiving the HostedModeException... Thanks for your
interest anyway.

On 23 mayo, 04:14, Ricardo Campos <ricardocam...@gmail.com> wrote:
> Hello there!
>
> It seems that the JavaBeans must implement
> com.google.gwt.user.client.rpc.IsSerializable so they can be
> integrated correctly with their JavaScript versions.
> So, in this case, the declaration of your class should be:
>
> ***
> import com.google.gwt.user.client.rpc.IsSerializable;
> ***
>
> public class SignInStatus implements Serializable, IsSerializable {
>
> ***
>
> }
>
> That should do it! The documentetion from Google says that it should
> be one interface or another, but it only worked for me when I
> implemented IsSerializable. And there seems to be no problem leaving
> both interfaces implemented (wich is good)! Remember that the child
> objects of the class should also follow the same pattern...
> Read more here:http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...

xavybb

unread,
May 30, 2008, 8:08:45 AM5/30/08
to Google Web Toolkit
Solved!

I don't know why but I created a new Seam project and all work fine.
Now I can receive my DTO and use it in GWT.

I'll investigate a little bit this situation to find an explanation
and post it here.

Thanks a lot for your time.

Ed

unread,
Jun 23, 2008, 8:03:19 AM6/23/08
to Google Web Toolkit
For what it's worth:

I encountered the same problem. I got the problem when I spilt up an
existing dto into a parent child class and forgot to include the
parent class in the policy.gwt.rpc file that I manage myself. I am
running in -noserver mode btw.
I am using gwt 1.5 rc2.

Hope it helps
Reply all
Reply to author
Forward
0 new messages