19

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.

Saintali
  • 4,482
  • 2
  • 29
  • 49
  • 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 Jan 18 '12 at 21:14
  • 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 Jan 21 '12 at 10:55
  • This question is duplicated at http://stackoverflow.com/questions/9984298/gwt-something-other-than-an-int-was-returned-from-jsni-method where a work-around is given. – Glenn Jun 11 '13 at 03:09

1 Answers1

17

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.

jusio
  • 9,850
  • 1
  • 42
  • 57
  • Strange, as they both come from Google. Actually I have a legacy application here and porting to Firefox needs additional effort :( – Saintali Jan 18 '12 at 16:31
  • strange indeed, we had to create separate JSON parser for our project, because DevMode in Chrome was always crushing with standard implementation. Unfortunately there is no such workarounds for frameworks like GXT. – jusio Jan 18 '12 at 16:40
  • 2
    Worth pointing out that this only happens in dev mode (compiled code will be fine), and only with some jsni, some of the time). This is a longstanding problem, and will eventually happen with any jsni. http://code.google.com/p/google-web-toolkit/issues/detail?id=5778 – Colin Alworth Jan 18 '12 at 17:16
  • 2
    Thanks Colin, I find it strange again, as this bug was filed in Dec 2010 and is about GWT 2.1.0 and and Chrome 10.0.612.1. Centuries have passed since then. – Saintali Jan 21 '12 at 11:02
  • 1
    This happens with IE 10 as well (Windows 8 if that matters) – Καrτhικ Jun 28 '13 at 19:35