Search code examples
javaintellij-ideagwt

How to debug GWT project in Idea


I have a webapp writen in GWT (2.10.0) + Spring Boot (2.7.x) and Java 8. I can run my app from Idea 2022.1.4 using Tomcat configuration (9.0.80) and I can debug server side code. Now I need to debug client side code as Java code. I tried multiple options with no success.

  1. I created a GWT Configuration (please see screenshot #1) and tried running my app with it but I'm getting the following error in my log:
Loading modules
   com.myapp.MyApp
      Loading inherited module 'com.google.gwt.user.User'
         Loading inherited module 'com.google.gwt.core.Core'
            Loading inherited module 'com.google.gwt.emul.Emulation'
               Loading inherited module 'com.google.gwt.emul.Preconditions'
                  [ERROR] Element 'module' beginning on line 16 contains unexpected attribute 'type'
                  [ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)

GWT Configuration

  1. Another option I tried is creating Application launcher in Run/Debug Configuration Application configuration for DevMode. In that case I have a different error:
14:11:48.702 [main]  INFO  log - Logging initialized @2029ms to org.eclipse.jetty.util.log.Slf4jLog
   Loading Java files in MyApp.
   [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
Disconnected from the target VM, address: '127.0.0.1:62389', transport: 'socket'

Process finished with exit code 1

I found in google serach that this exception might be a bug in Idea and possible fix is to add <property name="idea.dynamic.classpath.jar" value="false" /> to Idea's other.xml file. I did that and now my other.xml looks like below:

  <component name="PropertiesComponent">
    <property name="idea.dynamic.classpath.jar" value="false" />
    <property name="CWM_LOGGING_VERSION" value="1" />
    <property name="FindSplitterProportion" value="0.32956687" />

However, it didn't help me and I'm still getting the error. Also, com.google.gwt.user.User module inherited in my MyApp.gwt.xml but I tried adding com.google.gwt.core.Core explicitly.

Does anybody have an idea what I have missed?


Solution

  • I found a problem with my project. Originally, it was written with GWT 2.4.0 and I migrated recently to GWT 2.10.0. All GWT dependencies in my pom.xml were upgraded to 2.10.0; however, I found that Project Settings -> Modules -> GWT pointed to 2.4.0. I recreated GWT module and choose 2.10.0. It fixed the problem.