Something other than an int was returned from JSNI method

6.9k views Asked by At

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

There are 1 answers

5
jusio On BEST ANSWER

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.