19
votes

I am running a GWT application in hosted mode. Sporadically I get a strange HostedModeException complaining about the type of the JS value returned from JSNI. Sometimes it is during deserialization:

 com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()': JS value of type boolean, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.readInt(ClientSerializationStreamReader.java)

sometimes at:

 com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.impl.DOMImpl::eventGetTypeInt(Ljava/lang/String;)': JS value of type null, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.google.gwt.user.client.impl.DOMImpl.eventGetTypeInt(DOMImpl.java)
    at com.google.gwt.user.client.impl.DOMImpl.eventGetTypeInt(DOMImpl.java:62)
    at com.google.gwt.user.client.DOM.eventGetType(DOM.java:602)
    at com.google.gwt.user.client.Event$.getTypeInt$(Event.java:695)
    at com.extjs.gxt.ui.client.util.BaseEventPreview.onPreviewNativeEvent(BaseEventPreview.java:139)

once again at

com.google.gwt.dev.shell.HostedModeException: Something other than a float was returned from JSNI method '@com.extjs.gxt.ui.client.util.Util::parseFloat(Ljava/lang/String;F)': JS value of type boolean, expected float
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:118)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeFloat(ModuleSpace.java:235)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeFloat(JavaScriptHost.java:67)
    at com.extjs.gxt.ui.client.util.Util.parseFloat(Util.java)
    at com.extjs.gxt.ui.client.core.El.getFrameSize(El.java:1081)
    at com.extjs.gxt.ui.client.core.El.setSize(El.java:2702)
    at com.extjs.gxt.ui.client.widget.BoxComponent.setSize(BoxComponent.java:501)
    at com.extjs.gxt.ui.client.widget.BoxComponent.setHeight(BoxComponent.java:320)

Can anyone help me on this? I am using GWT 2.4.0, Google Chrome 16.0.912.75 and GWT Developer Plugin 1.0.9738.

1
I would like to help, as I also get this kind of random Exception every now and then... but I have no idea! Anyway, it doesn't affect my debugging usually, so I just live with it... but it would be nice to know what's behind that. - Renato
May case was like yours, happened once a month or so, but now in the project I am currently working on this is happening recurrently, many times a day. That's why I feel there may be something wrong with my configuration. Unfortunately it is also difficult to reproduce. In jusio's word, it's magical. - Saintali
This question is duplicated at stackoverflow.com/questions/9984298/… where a work-around is given. - Glenn

1 Answers

17
votes

For some magical reason chrome works very badly with GWT DevMode. Random null pointer exception while parsing JSON, JSNI return types errors when working with GXT, remote death exceptions are a very common problems. It is known problem and that's why most people are not using GWT DevMode with Chrome.