GWT 2.9, JDK 11 and Tomcat

165 views
Skip to first unread message

Ying Jin

unread,
Mar 17, 2022, 6:59:04 PMMar 17
to GWT Users
Hello,

Recently, I started to resume on our GWT upgrade project with GWT 2.9 and JDK 11.

As it has been discussed before, the embedded Jetty server can't work with JDK 11 due to the ASM lib version issue. The recommended approach is to set up an external server, so I followed the following GWT document to manually configure GWT development mode by following steps specified in the second Video. I've watched the video and tried this approach many times, but it still gave 404 error. It seems hard to setup external server and configure Development mode correctly for our project.

Any input or suggestion is greatly appreciated!


Manually Configure GWT Development Mode

Manually Configuring the -launcherDir in the GWT Eclipse Plugin

Our GWT project is not Maven oriented and it was developed several years ago with a big codebase. 

Step 1: Converted Aries project to Dynamic Web Project by adding project facet "Dynamic Web Module" in Eclipse.

Step 2: Set up Apache Tomcat 9 Server

Step 3: Add the project to server. Right click on Server -> Add and Remove

Step 4: Start the Tomcat Server

Step 5: Right click project->Debug As -> GWT Development mode

Step 6. It started fine. Stop it so we can add the -launcherDir Program Arg

Step 7: Double click on Tomcat server, select Open launch configuration

 Get the server web app directory root: wtp.deploy

Copy path

 C:\EclipseGWTCodeServerWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps

Step 8. Open the file explorer to see the deployment path

Step 9: Go to Debug Configurations

GWT Development Mode (CodeServer)->Arguments.

Add -launcherDir

Value: It is the wtp.deploy arg + context path.

After updated the Argument to GWT Development Mode(CodeServer), the Arguments tab has following content:

-launcherDir C:\EclipseGWTCodeServerWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\aries -logLevel INFO -port 9876 edu.vanderbilt.mc.aries.ARIES

Step 10 Launch the code server, click on Debug from CodeServer dialog. Now both the Web Server and Code Server are running. Back to the file manager. Watching for the application directory to be created.

Step 11: Launch the browser for debugging with the Javascript Debugging

Open with SBDG debugger

Step 12: Open browser with Code Server URL: 127.0.0.1:9876 and Change the port number to 8080 ( the Tomcat web server port number)

It gave me 404 Not found error.

Your help is greatly appreciated, 

Jenny

Craig Mitchell

unread,
Mar 19, 2022, 1:50:39 AMMar 19
to GWT Users
It sound like your GWT code server launcher directory setting isn't correct.  And it doesn't look correct either.  It should be the war directory of your project.

So, something like "c:\whereever_your_code_is\your_project\war" (you might not have called it "war", it's called whatever you put in the settings in GWT -> Web Application -> WAR directory).

Basically, the GWT code server needs to override the (your_module).nocache.js file, so it need to know where that is, and that is in a directory under your war directory.

Ying Jin

unread,
Mar 21, 2022, 4:12:54 PMMar 21
to GWT Users
Craig, 

Thanks very much for your help! After I changed the launcherDir value to the path of my war file location as you suggested, the problem got solved. I can run the application in super dev. mode with GWT 2.9, JDK 11 and Tomcat 9. 

-launcherDir C:\Users\jiny\gitCodeServer\aries\war

The reason I chose previous deployment path is that in the GWT Video it suggested to use wtp.deploy arg + context path for the launchDir value.

The thing I'm still a bit puzzled is that in GWT documentation, it suggested to use "noserver" for DevMode launcher argument, but I didn't add this option to the DevMode configuration. It still works to use GWT Development Mode after running the Tomcat server. The  launcherDir is added to the GWT Development Mode(CodeServer) launcher configuration. It would be great that you help explain a bit.

During the process of running and debugging the application in this updated environment, I have two questions and hope they can be clarified:

(1) Is there anyway to show log4j debugging information in the "Console" view in Eclipse? After the application is compiled and loaded, the logging information is removed and it only shows blank window with "Aries(1) [launch Chrome]".

(2) As we can only use JS debugger, it will only show javascript variable name and we used to use "Watch" to check expression value, but we don't have this option any more. 
 Java System.out message can no longer be displayed in the console.  Any tips for debugging in the super dev. mode?

Your help is greatly appreciated!
Jenny

Craig Mitchell

unread,
Mar 21, 2022, 6:19:29 PMMar 21
to GWT Users
>  GWT documentation, it suggested to use "noserver" for DevMode launcher argument

> (1)
This is outside of GWTs responsibility.  Sounds like you have an Eclipse / Log4j / Tomcat config issue.

> (2)
To watch a variable, just use Chromes debugger:  https://developer.chrome.com/docs/devtools/javascript/reference/#watch

Use log, use GWT.log("...") to log messages when running in dev.

To log messages in production, you'd need something like this:

public static native void log(String log) /*-{
        $wnd.console.log(log);
}-*/;

Hope this helps.  :)

Craig Mitchell

unread,
Mar 21, 2022, 6:27:38 PMMar 21
to GWT Users
(2) As we can only use JS debugger, it will only show javascript variable name.

Also, you should see the Java variable name, as well as the Java code, but in the Chrome JS debugger.  GWT uses source maps to map them together.

Ying Jin

unread,
Mar 21, 2022, 7:13:49 PMMar 21
to GWT Users
Great tips! Craig, thank you so much! Your answers saved us much time in this upgrade project and finally it works correctly! have a great rest of the week! Jenny :)
Reply all
Reply to author
Forward
0 new messages