Showing posts with label gwt. Show all posts
Showing posts with label gwt. Show all posts

Tuesday, September 11, 2012

GWT Development Plugin Firefox 15 (FF15) on 64bit ubuntu

I tried the latest plugin from well known source. But it didn't work.
But this one did.

Wednesday, August 1, 2012

GWT/GXT Unable to get value of property 'user.agent'

If your app hangs in IE/IE8 during load and you have

Unable to get value of property 'user.agent'

error under Development Mode, you should instruct your IE how to interpret application's page. To do this, put

<meta http-equiv="X-UA-Compatible" content="IE=8">

in your index.jsp or whatever you use to render the app.

More information on GWT wiki page.

Monday, July 30, 2012

GWT has bug in Dev mode for Chrome

It happens when trying to check visibility of component. So be careful with
component.isVisible()
as it fails on Chrome.

Same thing is for GXT (extgwt from Sencha) as it calls underlaying GWT's isVisible()


(UncaughtExceptionHandler.java:23) 2012-07-30 12:55:02,147 [ERROR] java.lang.ClassCastException: java.lang.String cannot be cast to com.google.gwt.dom.client.Element
java.lang.ClassCastException:
java.lang.String cannot be cast to com.google.gwt.dom.client.Element
    at com.google.gwt.dom.client.DOMImpl.getParentElement(DOMImpl.java)
    at com.google.gwt.dom.client.Node$.getParentElement$(Node.java:184)
    at com.google.gwt.user.client.DOM.getParent(DOM.java:892)
    at com.extjs.gxt.ui.client.core.El.getParent(El.java:1274)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1889)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1874)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1898)
    at com.extjs.gxt.ui.client.widget.Component.isVisible(Component.java:767)
    at com.extjs.gxt.ui.client.widget.Component.isVisible(Component.java:754)
    at pl.touk.mnp.frontend.webapp.client.widgets.RichDateComboFilter.handleBeforeLoadEvent(RichDateComboFilter.java:258)

When using development mode, better use Firefox. In production Chrome works well without bugs.

EDIT:
When using shallow visibility checking
component.isVisible(false);
the error can be avoided. GWT isn't traversing through DOM tree and it doesn't blow with an exception but you have to check whether shallow visibility checking is sufficient (in most cases it is).

Thursday, July 19, 2012

New Firefox 14 ruined all my GWT work (Ubuntu 12.04)

That's because there's no GWT Development Mode plugin for Firefox 14. And now I can't work!

Wait! There's a solution. Instead of fighting with ubuntu with reversing installed Firefox to 13. I can have parallel versions of FF.

So how to install previous version of Firefox on ubuntu?
Go there


http://mirror.dacentec.com/mozilla/firefox/releases/

and download your binary. Be cautious with 32 and 64 version. If you don't know what version do you have, call


uname -m

and it'll tell you.

Then unpack your version to desired directory (other than current Firefox's dir).
Close any running Firefox instances and run your downloaded version. Beware of upgrading both firefox and any plugins. Don't do this. This copy should remain as is.


If you're looking for unofficial GWT Development Plugin versions (for FF12, FF13 and soon for FF14)  you might looking at my gwt entries.

Wednesday, June 13, 2012

GWT Developer's Plugin for Firefox 13

I dug it from the net.

For Firefox 13

Friday, May 11, 2012

GWT Hosted mode on 64bit linux

GWT for linux is build against 32bit architecture. It contains some SWT/GTK 32bit modules. So if you try to run it with 64bit java it fails

Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/tools/sdk/gwt/gwt-linux-1.5.3/libswt-pi-gtk-3235.so: /opt/tools/sdk/gwt/gwt-linux-1.5.3/libswt-pi-gtk-3235.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1003)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:132)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:126)
    at com.google.gwt.dev.GWTShell.<clinit>(GWTShell.java:301)
Could not find the main class: com.google.gwt.dev.GWTShell.  Program will exit.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR


You have two choices. Find 64bit SWT/GTK modules with same build version (3235 in this case) - good luck! or download 32bit JRE.

I chose second option and it took me 3 mins to resolve the problem.
Find proper JRE version on Oracle site I suggest bin file instead rpm. It unpacks jre to own dir. Move that directory to some convenient location (it doesn't matter where). Edit gwt.properties and set java.executable to java exec located in 32bit JRE.
Now run your GWT hosted mode and be unstoppable developer!




You may have some warnings from GTK, such as

/usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so: wrong ELF class: ELFCLASS64
(GWT:351): Gtk-WARNING **: Failed to load type module: /usr/lib/gtk-2.0/2.10.0
/menuproxies/libappmenu.so


But it has no consequences for me, so far...



Some sources say that you should set an environment var:

export LIBXCB_ALLOW_SLOPPY_LOCK=1

to block bugs in X display layer but I don't know what does it mean :)


In this case I had to hadle with GWT version 1.5.3 (old corporate project)
 

Tuesday, August 30, 2011

Kolejność budowania aplikacji w GWT i odpalanie testów (maven)

Nie umiałem dobrać tytułu. Wydaje mi się mylący, ale pościk jest o tym, że warto tak skonfigurować plugin GWT do mavena, aby aplikacja była kompilowana do JS dopiero po testach.
Wiadomo, że jeśli testy nie przechodzą, to nie ma sensu budować aplikacji. Jeśli omijamy testy (bywa i tak), to opisana niżej zmiana jest przeźroczysta.

W nowszych wersjach GWT (okolice 2.1.0) plugin buduje aplikację właśnie po testach, ale we wcześniejszych domyślnie odbywa się to w fazie compile. I to jest właśnie rozwiązanie. Należy przypiąć kompilację do JS w fazie po testach, ale przed budową paczki. Jeśli spojrzymy na pełną listę faz, to jest ich kilka "pomiędzy". Ja wpiąłem się w prepare-package i osiągnąłem zamierzony efekt. Poniżej typowa konfiguracja plugina mavenowego, w której określamy fazę uruchomienia (pominąłem konfigurację plugina):

                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>gwt-maven-plugin</artifactId>
                        <version>${gwt.maven.plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>



Dzięki temu oszczędziłem sporo czasu, bo zajmuję się projektem w którym budowanie aplikacji (8 permutacji!) zajmuje 4-5 minut. Do niedawna przy domyślnej konfiguracji najpierw kompilował się JS, a dopiero potem uruchamiały się testy. Szkoda tego czasu, tylko po to, aby w trakcie testów (które też trwają ok minuty), dowiedzieć się, że wysiłek był na marne.

Thursday, March 31, 2011

GWT Designer for Eclipse 3.6 can cause project compile freeze

Lately I installed GWT Designer for Eclipse Helios (3.6). I wanted to check it's features. They aren't so cool I've expected but that's other story. The problem was that suddenly my main GWT enabled project began to freeze during compilation.  The project is maven enabled also.
So it freezed in about half of compilation. All other features of Eclipse worked well. Restarting Eclipse and Windows didn't help anyway.
After about an hour of investigating I've found that GWT Designer caused this. After removing it all came back to order.

Ofcourse I suspect that something is wrong with my Eclipse for example I have too many bizzarre plugins installed but if I could have such problems you could have them too. So be warned :-)

Thursday, March 24, 2011

(Another) GWT exception in Development Mode

Lately I got a new kind of exception during GWT Development Mode startup.


java.lang.NullPointerException
        at com.google.gwt.dev.resource.impl.DirectoryClassPathEntry.descendToFindResources(DirectoryClassPathEntry.java:79)
        at com.google.gwt.dev.resource.impl.DirectoryClassPathEntry.findApplicableResources(DirectoryClassPathEntry.java:54)
        at com.google.gwt.dev.resource.impl.ResourceOracleImpl.refresh(ResourceOracleImpl.java:351)
        at com.google.gwt.dev.cfg.ModuleDef.refresh(ModuleDef.java:386)
        at com.google.gwt.dev.cfg.ModuleDefLoader.tryGetLoadedModule(ModuleDefLoader.java:150)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:136)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:963)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:468)
...


This was because after I started Development Mode, my IDE cleaned compiled classes directory(target/classes/ in my case).
Rebuild project and I'll be back to game :)

Did you like the post? Was it helpful? Leave a comment!

Thursday, February 10, 2011

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. 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" />


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.