Is there some description anywhere how to set up a decently usable GWT 2.10 development environment?

180 views
Skip to first unread message

mmo

unread,
Dec 14, 2022, 12:21:59 PM12/14/22
to GWT Users
Over the last years our GWT development environment has eroded more and more.
First the browser plugins seized to work, then the mapping/JS-code-backtranslation stopped working and recently also the IDE plugins for Eclipse and IntelliJ that would deploy the generated artifacts to the correct places, start the code server and allowed some minimalistic form of debugging seized to work. It is getting more and more not just frustrating but really horrible and "mission impossible".

Thus a while ago I began an effort to port our application to GWT 2.10 and Java 8 (our "production version" still runs with GWT 2.7 and Java 7 and I can't go to higher Java versions due to some libraries, yet). 

Meanwhile I found my way through all the library conflicts so that I am able to build and generate a version that runs fine when deploying the generated .war file to to a Tomcat Server (v8.5 in our case).

But being able to building a running version is one thing. The other is to have a development setup that doesn't shy away developers crying and yelling but allows to do decent client side code debugging.

With the "old" GWT plugin the commands "gwt:run" and "gwt:debug" didn't work anymore with GWT 2.10. I keep getting the following error during Jetty startup:

java.lang.IllegalArgumentException: Object of class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' is not of type 'org.eclipse.jetty.webapp.WebAppContext'.
Object Class and type Class are from different loaders. in file:///D:/Projects/our-app/our-app-web/target/our-app/WEB-INF/jetty-web.xml
     at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:421)
     ...


I also read in this forum that other people had issues with GWT 2.10 and Jetty (and that the maintainers of GWT are aware of that but don't plan to fix this) so I guess it's time to switch to deploying to Tomcat, instead. Probably I also will switch to the new GWT plugin (by T.Broyer). I already tried it and I can at least build the same .war file using it.

But how do I set this while thing up to provide a better developer experience? Is there some example or description of how to deploy a GWT 2.10 application to a Tomcat server in development mode (i.e. with code server and - if possible - hot code replacement, etc.)? How can GWT development be made "convenient" or at least acceptable again? 

Any pointers, descriptions or examples would be highly appreciated!

Josselin Bardet

unread,
Dec 14, 2022, 12:53:35 PM12/14/22
to google-we...@googlegroups.com
Hi,

We succesfully use the gwt 2.10 dev mode to run and debug our applications. We had to overide the JettyLauncher class to be able to run it with java > 8.
What kind of issue do you have with the dev mode (with gwt plugin on eclipse) ?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/d2fd58f0-f5e7-4a2b-9320-45d5ec244379n%40googlegroups.com.

Maple Veritas

unread,
Dec 14, 2022, 2:50:58 PM12/14/22
to GWT Users
It is a bit of a challenge to get GWT to work well in IntelliJ with Jetty. We finally got it working very well a year ago, thanks to a site that explained some of the key points for getting it to work. The URL of the site is https://imsavva.com/how-to-debug-gwt-in-2021-and-fix-error-scanning-entry/

The site is a bit dated, but the main points are still valid. If you use jetty, do use jetty 10, not jetty 11. GWT 2.10.0 works. Java versions all the way to java 17 work. Not sure whether jetty 9.4 works with Java 9 and up; we never tried that combination. Over the last year, our combinations, with IntelliJ, have been:

1. gwt 2.8.2 with builtin jetty 9.2 (initially, before we moved to using the jetty plugin in IntelliJ))
2. gwt 2.8.2, gwt 2.9.0, and gwt 2.10.0 with jetty plugin (jetty 9.4) and java 8
3. gwt 2.10 with jetty 10 and jetty plugin and java 17. This is what we have now. The GWT configuration is a tiny bit different as GWT 2.10.0 can only handle Java 11 right now, not Java 17.

We never found the need to use the jetty plugin until we needed to use WebSocket and jetty 9.2 can't handle WebSocket very well. There was a way to get around it, but unfortunately that way was blocked by Java 9 and up. A year ago, I found out about that site. I followed the instructions from that site and got everything working with some changes, as my source code structure is different from his.

Let me know if you encountered an issue you can't solve. I don't check the mailbox of this email address, so posting the questions here is better. If this is the right way to go about this in this group.

We have been using GWT since the beginning, for almost 15 years now. We started using jetty about 8 years ago; before that, we were using Tomcat (and Apache). We migrated from Eclipse to IntelliJ about 3 years ago. We never use maven as we need to be able to build the whole system with everything included in a repo (except Java). Just a weird requirement, that is for sure. So, we are still using ant to build our war file as well.

Frank

unread,
Dec 15, 2022, 8:34:52 AM12/15/22
to GWT Users
Maybe https://dev.to/ibaca/modern-gwt-first-steps-509k can help

As a note. We use the paid version of IntelliJ. This has a GWT plugin aboard which we find very usefull.

Op woensdag 14 december 2022 om 20:50:58 UTC+1 schreef maple.c...@gmail.com:

Frank Hossfeld

unread,
Dec 15, 2022, 10:13:52 AM12/15/22
to GWT Users
Depending on your backend (Spring Boot or not) you can generate ready to go Maven-projects. Use Maven goals to start the code server and the server. And debug inside the browser. No need for a GWT-plugin inside the IDE. 

Use: https://github.com/tbroyer/gwt-maven-archetypes to generate a module with separate client, server and shared module in case you do not have a Spring Boot server. Use: https://github.com/NaluKit/gwt-maven-springboot-archetype in case you prefer to use Spring Boot. This one also generates separate client-, shared- and server-module. Both are perfect starts for an update. 

When working on Windows use: mvn:devmode instead of mvn:codeserver .

Jeff Hill

unread,
Dec 15, 2022, 12:18:14 PM12/15/22
to GWT Users
Hi, FWIW - have also been working with GWT since the start - it took a little while to get used to developing without the browser plugins (old GWT), but honestly, the "NEW" way of running GWT is much better in every way.   Stick with it and ask questions.  The community is amazing.  

We have a GWT app that was started in 2012 and it's still a pleasure to work with a decade later.

Unfortunately, since the project is older it isn't compatible with the newer maven plugins that make development *very* easy (2 command lines to run the app server and GWT development mode)

We have Tomcat in production and chose to do development with a Tomcat server as well.

Using Eclipse, Eclipse GWT Plugin, Eclipse, Java 11+, Managed Tomcat Server 9, GWT 2.9, ANT to compile the war.

Adjust the server.xml in Eclipse to know where to find the war folder for your GWT project...
<!-- Note the relative path for docBase to allow Eclipse to find the project war directory - or hard-code the path -->

<Context path="/APPNAME"

   docBase="../../../../../PROJECTNAME/war" reloadable="true"

   crossContext="true" debug="0" distributable="true">

...

</Context

Set the program arguments to:

Note Bind Address lets you connect from other devices on the same network - helpful to try out the GWT app via tablet, etc.

-port 9876 -bindAddress 0.0.0.0 -logLevel INFO -war C:\...\PROJECTNAME\war {{GWT Module Names ie.  com.app.ModuleA}}

Set the VM arguments to:

-Xmx1024m -Xms54m 




mmo

unread,
Dec 16, 2022, 4:22:48 AM12/16/22
to GWT Users
Thanks the misc. links and comments! Highly appreciated. Will try to work through them to get us going.

@nam...@gmail.com

> What kind of issue do you have with the dev mode (with gwt plugin on eclipse) ?
After my last eclipse update (to 2021-12) the GWT plugin (V3) just seized to work. It doesn't even show up anymore (in Views, Preferences, etc.).
I even un- and re-installed it but it doesn't appear anywhere. According to some Google-matches I am not alone with that. :-(

@frank.h...@googlemail.com
> Depending on your backend 
We are not using a spring boot server. For testing we deploy to a Tomcat and we deliver our application with an embedded tomcat. 
That's why a setup using Tomcat would be an optimal solution.

Jens

unread,
Dec 16, 2022, 4:53:09 AM12/16/22
to GWT Users
I use Jetty but manage it externally and not via GWT or any build tool plugin. Usually I use a Jetty docker container, preconfigured as much as possible to match production environment. Then I either mount the generated *.war file directly into the container or I mount a local webapps folder into the Jetty webapps folder inside the container.

Before using Jetty docker container I used IntelliJ Ultimate to manage Jetty within IntelliJ. In that scenario I had a run configuration that (re-)starts jetty and before doing so that run configuration executed the build tool to update the *.war file deployed in Jetty.

The key point in both approaches is to have a separately managed servlet container, ideally matching production configuration. Because of that I never had any issues with any GWT release or build tool plugin and I usually use a GWT build directly from GWT's main branch.

-- J.

lofid...@gmail.com

unread,
Dec 16, 2022, 12:59:48 PM12/16/22
to GWT Users
I agree with Frank,

I never use Plugin from Eclipse or IntelliJ. Just use pure Chrome and Maven for building the project, debugging, etc.. That's it. Here is the shortest example: https://bit.ly/WebJavaStory

The first step I always take is to separate the GWT project from the "server" project. Why? Because with this separation I could use whatever libraries I need to use. 

Remember: At the end, GWT is a transpiler (source to source compiler from Java source to JavaScript source). I'm always be able just to copy the JavaScript result to my web server, together with HTML and CSS.

For a very simple example take a look the standard GWT example StockWatcher (https://www.gwtproject.org/doc/latest/tutorial/gettingstarted.html) in the "new" environment: https://github.com/lofidewanto/stockwatcher

Hope this helps!
Reply all
Reply to author
Forward
0 new messages