Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "XmlRootElement cannot be resolved to a type" error after upgrading GWT from 2.8.1 to 2.8.2

Tags:

java

gwt

In order to fix the broken GWT drag and drop in Chrome 61, we decided to upgrade GWT since the fix is in GWT 2.8.2.

After upgrading, I got hundreds of following errors:

[ERROR] Line 7: XmlRootElement cannot be resolved to a type
[ERROR] Line 3: The import javax.xml.bind cannot be resolved

I tried to upgraded other dependencies to the latest version and got no luck. Any solutions or suggestions are appreciated. Thanks.

like image 325
brian17han Avatar asked Nov 03 '17 14:11

brian17han


2 Answers

You need to add a dependency on that jar now, it is no longer part of GWT (and probably shouldn't have been to begin with, which is why it is gone):

Maven:

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.3.0</version>
  <classifier>sources</classifier>
  <scope>provided</scope>
</dependency>

Gradle:

gwt 'javax.xml.bind:jaxb-api:2.3.0'

EDIT: Correction, it looks like this might not be just related to updating GWT, but specific to Java 9 - no longer are these classes included in JDK 9, so you must actually have a dependency on the jaxb-api in your project.

like image 100
Colin Alworth Avatar answered Oct 03 '22 14:10

Colin Alworth


Using this dependency (added in your POM file) has solved the problem for me

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
</dependency>
like image 26
Himanshi raikwar Avatar answered Oct 03 '22 14:10

Himanshi raikwar