Today I needed to deploy an early preview version of our GWT based product to the testing server on the customer site. I didn’t mentioned early but our product is a large content repository for famous Bulgarian telecom. It took me 2 hours or maybe more to write and debug ant based build script but it didn’t work. This was the script:
I changed the original project name and class names in the above script name to keep the NDA signed for this project.
The build was successfull, the created WAR file was correct, but the application didn’t work. Why?
The reason was the library “gwt-user.jar”. It is intented to run in GWT Shell, but when deploying on Java EE server you need to replace it with “gwt-servlet.jar”. Otherwise the RPC services will not work saying “Class not found: com.google.gwt.user.client.rpc.RemoteService”. It is strange error because this class is part of “gwt-user.jar” but cannot be loaded.
I had the “gwt-user.jar” and “gwt-servlet.jar” in my “lib” directory but I included the first in the Eclipse’s build path and excluded the second. In the ant script I do the opposite. … and it now works. Chreers!
I was using Tomcat 6, Java 6, Eclipse 3.3 (ahhhh bugger). I first mapped the GWT RPC services to servlets in the WEB-INF/web.xml deployment descriptor. Initially I had an idea to write custom task for the ant script that reads the MyModule.gwt.xml file and XSL transforms it to a section in the web.xml file but this was too complex. I prefer working solutions insted of complex general (and sometime working) ones.