GWT Compilation Error - IncompatibleClassChangeError

前端 未结 8 2439
暗喜
暗喜 2021-02-14 10:07

When compiling the project, I get this obscure Exception

Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
Loading archived module: jar:         


        
相关标签:
8条回答
  • 2021-02-14 10:09

    In my case I had to remove the asm 3.1 from my classpath and there are few jars which has internal dependency on asm 3.1. Which i had to exclude from the dependency in my pom. example:

    <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>2.7.18</version>
            <exclusions>
              <exclusion> <!-- exclude version 3 of asm -->
                <groupId>asm</groupId>
                <artifactId>asm</artifactId>
              </exclusion>
    
            </exclusions>
          </dependency>
    

    There were other jars which has such internal dependency, use maven dependency tree to identify. and exclude asm dependency.

    Note: you can even upgrade these jars to higher versions which in fact support higher versions of ASM(>4.0), which should be fine with GWT 2.7 or 2.8

    0 讨论(0)
  • 2021-02-14 10:10

    This happened to me when I had gwt-servlet.jar on my classpath during the compilation. If using maven, mark (set the scope) the dependency of gwt-servlet.jar as provided

    0 讨论(0)
  • 2021-02-14 10:13

    In my case I had to exclude an asm artefact coming from a hibernate validator library so you should be fine excluding any asm artefact in your maven configs for your gwt module.

    0 讨论(0)
  • 2021-02-14 10:23

    Please try it again after removing all the generated stub and re-compiling the project again.

    I have highlighted all the stubs that needs to be deleted as shown in below snapshot.

    enter image description here

    Here is the list of folders (name can vary based on your GWT project compilation module name) that need to be removed.

    • gwt-unitCache
    • test-classes
    • war > gwtproject
    • war > WEB-INF > classes
    • war > WEB-INF > deploy
    0 讨论(0)
  • 2021-02-14 10:27

    In my project, a modular GWT application, I had to add a dependency to gwt-dev into the module that started the whole app.

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <scope>provided</scope>
    </dependency>
    
    0 讨论(0)
  • 2021-02-14 10:34
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>4.0</version>
    </dependency>
    

    I migrated the asm version to 4.0 and the issue got solved

    0 讨论(0)
提交回复
热议问题