GWT exception in Hosted Mode

I work with GWT version 1.7.0. It’s old but our product requires it. Recently I had to debug using Hosted mode under Windows XP. During Hosted mode startup I had an exception

2011-02-08 17:04:31,578 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException:(TypeError):
Object doesn't support this property or method. number: -2146827850
 description: Obiekt nie obsługuje tej właściwości lub metody.
    at com.google.gwt.user.client.impl.DOMImplStandard.initEventSystem(Native Method)
    at com.google.gwt.user.client.impl.DOMImplMozilla.initEventSystem(DOMImplMozilla.java:39)
    at com.google.gwt.user.client.impl.DOMImpl.maybeInitializeEventSystem(DOMImpl.java:111)
    at com.google.gwt.user.client.impl.DOMImplStandard.sinkEvents(DOMImplStandard.java:140)
    at com.google.gwt.user.client.impl.DOMImplMozilla.sinkEvents(DOMImplMozilla.java:27)
    at com.google.gwt.user.client.DOM.sinkEvents(DOM.java:1221)

After some investigation I found the reason.
During development, for performance reasons I compile my GWT apps only for Firefox. So this was the case. You must know that in earlier versions of GWT (and so in 1.7.0), application is displayed in special window with embedded Internet Explorer. And now you might look closer to the stacktrace above and see that there are some Mozilla classes involved and that’s wrong because for IE we should have only IE classes! So that’s the cause I had exception.

So if you want to run Hosted mode you have to compile your GWT application at least with IE support. Add this to you *.gwt.xml config file

<set-property name="user.agent" value="ie6,ie8"></set-property>

Or leave it without declaring user.agent so it would be compiled for all supported browsers. Too shame that GWT doesn’t warn if it was not compiled for current browser.

If you still have problems with mentioned exception look at an issue in GWT bug tracker.

You May Also Like

Zabawy zespołowe: ćwiczenie głosu – RYBA!

Ćwiczenie ma za zadanie ośmielić osoby do mówienia głośno i wyraźnie. Ma też pomóc ustawić głos. Bardzo przydatne przy spotkaniach typu stand-up, gdzie "mruki" opowiadają pod nosem, co ostatnio robiły. Z mojego doświadczenia - działa!

Osoby biorące udział w ćwiczeniu stają w okręgu. Wybieramy sobie słówko do powtarzania. Proponowana jest ryba, ale może to być dowolne inne, proste w wymowie słowo.
Prowadzący ustala kierunek i jako pierwszy mówi szeptem ryba. Następnie, kolejne osoby powtarzają rybę, aż do donośnego"RYBA. Jeśli warunki pozwalają, można nawet krzyczeć, ale nie wrzeszczeć, bo wtedy wymowa jest niewyraźna. Po osiągnięciu maksymalnego (w pewnym sensie, ustalonego poziomu), zaczynamy ściszać głos, aż do szeptu. Naturalnie zabawę można powtórzyć dowolną ilość razy.

Jako szept warto przećwiczyć szept aktorski, czyli używanie szeptu, ale głośnego i wyraźnego, bez tembru głosu.

Mając jedno ustalone słowo, fajnie jest potem mobilizować kogoś kto mówi zbyt cicho wołając tylko "ryba!" i wtedy wszystko wiadomo.

Need to make a quick json fixes – JSONPath for rescue

From time to time I have a need to do some fixes in my json data. In a world of flat files I do this with grep/sed/awk tool chain. How to handle it for JSON? Searching for a solution I came across the JSONPath. It quite mature tool (from 2007) but I haven't hear about it so I decided to share my experience with others.

First of all you can try it without pain online: http://jsonpath.curiousconcept.com/. Full syntax is described at http://goessner.net/articles/JsonPath/



But also you can download python binding and run it from command line:
$ sudo apt-get install python-jsonpath-rw
$ sudo apt-get install python-setuptools
$ sudo easy_install -U jsonpath

After that you can use inside python or with simple cli wrapper:
#!/usr/bin/python
import sys, json, jsonpath

path = sys.argv[
1]

result = jsonpath.jsonpath(json.load(sys.stdin), path)
print json.dumps(result, indent=2)

… you can use it in your shell e.g. for json:
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}

You can print only book nodes with price lower than 10 by:
$ jsonpath '$..book[?(@.price 

Result:
[
{
"category": "reference",
"price": 8.95,
"title": "Sayings of the Century",
"author": "Nigel Rees"
},
{
"category": "fiction",
"price": 8.99,
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"author": "Herman Melville"
}
]

Have a nice JSON hacking!From time to time I have a need to do some fixes in my json data. In a world of flat files I do this with grep/sed/awk tool chain. How to handle it for JSON? Searching for a solution I came across the JSONPath. It quite mature tool (from 2007) but I haven't hear about it so I decided to share my experience with others.

Hibernate hbm2ddl won’t create schema before creating tables

Situation I have a local H2 in memory database for integration tests and an Oracle db for production. I do not control the Oracle DB model. The in memory H2 database is created automatically by adding <prop key="hibernate.hbm2ddl.auto">update&l...Situation I have a local H2 in memory database for integration tests and an Oracle db for production. I do not control the Oracle DB model. The in memory H2 database is created automatically by adding <prop key="hibernate.hbm2ddl.auto">update&l...