GWT Dev Notes

Overview

Notes taken during development of a GWT application.  The application was built on a Mac and deployed to a WebLogic application server.

Actual application package names have been replaced with com.example.

Environment

  • Java 1.7
  • GWT 2.5
  • mvp4g
  • restygwt

Development Environment

  • Mac
  • Eclipse Juno
  • Maven
  • git
  • FireFox with Firebug

Notes, Issues and Solutions

GWT module '<name>' may need to be (re)compiled
  • Error running war on weblogic (or other container): "GWT module '<name>' may need to be (re)compiled"
  • Observed after compiling and testing in Eclipse then building a war from the same repository and attempting to run on an application server.
  • Eclipse project default output folder is src/main/webapp/WEB-INF/classes (so that can run the app from Eclipse).  This is what causes the issue.
  • Solution
Testing app in Eclipse, regularly get out of memory exception
  • Start up the app in dev mode, run, test, make changes, start back at first page to reload app and about every 5-6 times get OOM exception: [ERROR] [AppName] - Unable to load module entry point com.example.myapp (see associated exception for details)
  • Solution
    • Increase permGen to 256mb or higher
    • In Eclipse open Run Configurations
    • Select the GWT Web Application
    • Select (x)=Arguments tab
    • Add to VM Options: -XX:MaxPermSize=256M
Getting Rebind issue for a service after I added throws to methods in the interface
  • Have an existing RPC service that was missing exception handling (someone just used printStackTrace).  I looked at Google's instructions on throwing exceptions back to the client (see http://www.gwtproject.org/doc/latest/tutorial/RPC.html#exceptions) and decided to remove the try catch blocks from the Impl and add throws to the service interface.  After updating the service interface and implementation with the new method signatures that included throws MyException build failed:

[INFO]    [ERROR] Errors in 'gen/com/mvp4g/client/Mvp4gModuleImpl_com_mvp4g_client_Mvp4gModuleGinjectorImpl.java'

[INFO]       [ERROR] Line 3429: Rebind result 'com.example.MyUpdatedServiceAsync' must be a class
[INFO]    Computing all possible rebind results for 'com.example.SomeOtherService'
[INFO]       Rebinding com.example.SomeOtherService
[INFO]          Invoking generator org.fusesource.restygwt.rebind.RestServiceGenerator
[INFO]             Generating: com.example.SomeOtherService_Generated_RestServiceProxy_
[INFO]                Generating: com.example.SomeOtherService_Generated_JsonEncoderDecoder_ 
  • Issue was the Exception class selected was not located in the source path (defined in AppName.gwt.xml) hence it would not be converted into JavaScript.  
  • Solution
    • To resolve the issue I moved the exception class to a client package.

No comments: