Sencha GXT Showcase

I work professionally using GWT and Sencha GXT. Sencha offers a showcase, which is a huge help to understand their components. Sometimes I need to alter their examples in order to test something. Copying all necessary files is quite laborious. Since the source code is provided along with the library, I decided to set it up under Eclipse. In this article, I want to share all the steps and pitfalls with you.

Requirements

  • GWT 2.4 (for GXT 3.0.x) or GWT 2.5+ (for GXT 3.1.x)
  • Java 1.6
    Keep in mind: GXT 3.0 won’t work with GWT 2.5+, and GXT 3.1 won’t work with GWT 2.4.

Create Eclipse project

  • New Project → Google → Web Application Project

    • Project name: GXT-Examples
    • Package: com.sencha.gxt
    • Uncheck “Use Google App Engine” and “Generate project sample code”

Copy files

  • Download and unzip the GXT library
  • Copy the subfolders from \examples-src\ into your src folder
  • Unzip gxt-examples-3.x.war (you might need to change the extension to .zip first)
  • Copy web.xml and the lib folder from WEB-INF (extracted war folder) into war/WEB-INF, except gwt-servlet.jar (this should already exist in your project)
  • For GXT 3.0.x: copy gxt-chart-3.0.x.jar, gxt-legacy-3.0.x.jar and uibinder-bridge-2.4.0.jar into war/WEB-INF/lib
  • For GXT 3.1.x: copy gxt-chart-3.0.x.jar, gxt-theme-neptune.jar and gxt-themebuilder.jar into war/WEB-INF/lib
  • Add all libraries to your build path (select all → Build Path → Add to Build Path)
  • Copy all files and folders from your extracted war file, except WEB-INF, into /war

Run the showcase

  • Run the com.sencha.gxt.explorer.Explorer.gwt.xml (Run as → Web Application) → Select explorerGray.html
  • This should fail with the following exception:

    org.apache.openjpa .persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent:

    • com.sencha.gxt.examples .resources.server.data.Music
    • com.sencha.gxt.examples .resources.server.data.Folder
  • Add a Java agent: Run → Run Configuration → Select GXT-Examples under Web Application → Arguments → Add to VM arguments (jar version might be different):
    -javaagent:${project_loc:GXT-Examples}\war\WEB-INF\lib\openjpa-all-2.1.0.jar

  • If the Google plugin removes this argument, make the run configuration read-only: Common tab → Select Shared file → Apply → Close
  • Select the *.launch file in your root project directory → Properties → Read-only → OK
  • Run your configuration one more time. This time the Sencha Explorer should launch in your browser after a while. Have fun experimenting!