Thursday, October 11, 2012

Help Getting a GWT error : com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.

GWT can be painful sometimes

I was getting the following error while using GWT 2.4.0, GWT 2.5.0 and 2.5.1


[gwt:compile]
auto discovered modules [za.co.enerweb.ies.iesmobile]
Compiling module za.co.enerweb.ies.iesmobile
   Validating units:
      Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.
 at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:109)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:276)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
 at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)
 at com.google.gwt.dev.jjs.ast.JCastOperation.traverse(JCastOperation.java:65)
 at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
 at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:116)
 at com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:48)
 at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:170)
 at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)
 at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:83)
 at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:137)
 at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:133)
 at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:82)
 at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
 at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:426)
 at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:395)
 at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
 at com.google.gwt.dev.jjs.impl.UnifyAst.mainLoop(UnifyAst.java:902)
 at com.google.gwt.dev.jjs.impl.UnifyAst.exec(UnifyAst.java:627)
 at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:604)
 at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
 at com.google.gwt.dev.Precompile.precompile(Precompile.java:278)
 at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
 at com.google.gwt.dev.Precompile.precompile(Precompile.java:141)
 at com.google.gwt.dev.Compiler.run(Compiler.java:232)
 at com.google.gwt.dev.Compiler.run(Compiler.java:198)
 at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
 at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
 at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
 at com.google.gwt.dev.Compiler.main(Compiler.java:177)
Caused by: java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object;
 at com.google.gwt.uibinder.rebind.W3cDocumentBuilder.startElement(W3cDocumentBuilder.java:127)
 at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
 at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
 at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
 at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
 at com.google.gwt.uibinder.rebind.W3cDomHelper.documentFor(W3cDomHelper.java:74)
 at com.google.gwt.uibinder.rebind.UiBinderGenerator.getW3cDoc(UiBinderGenerator.java:204)
 at com.google.gwt.uibinder.rebind.UiBinderGenerator.generateOnce(UiBinderGenerator.java:174)
 at com.google.gwt.uibinder.rebind.UiBinderGenerator.generate(UiBinderGenerator.java:129)
 at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
 at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657)
 at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
 at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79)
 at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276)
 at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:265)
 at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
 at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleGwtCreate(UnifyAst.java:355)
 at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:433)
 at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:237)
 at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:243)
 at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
 at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
 ... 37 more
      [ERROR] at MainPage.java(27): GWT.create(MainPage$MainPageUiBinder.class)
         com.google.gwt.dev.jjs.ast.JMethodCall
      [ERROR] at MainPage.java(27): (MainPage$MainPageUiBinder) GWT.create(MainPage$MainPageUiBinder.class)
         com.google.gwt.dev.jjs.ast.JCastOperation
      [ERROR] at MainPage.java(27): static MainPage$MainPageUiBinder uiBinder = (MainPage$MainPageUiBinder) GWT.create(MainPage$MainPageUiBinder.class)
         com.google.gwt.dev.jjs.ast.JDeclarationStatement
      [ERROR] at MainPage.java(23): {
  Page.$clinit();
  static MainPage$MainPageUiBinder uiBinder = (MainPage$MainPageUiBinder) GWT.create(MainPage$MainPageUiBinder.class);
}
         com.google.gwt.dev.jjs.ast.JBlock
      [ERROR] at MainPage.java(23): {
  Page.$clinit();
  static MainPage$MainPageUiBinder uiBinder = (MainPage$MainPageUiBinder) GWT.create(MainPage$MainPageUiBinder.class);
}
         com.google.gwt.dev.jjs.ast.JMethodBody
      [ERROR] at MainPage.java(23): private static final void $clinit();

         com.google.gwt.dev.jjs.ast.JMethod 
 
The UI Binder Java code
public class MainPage extends Page {

    @UiField
    ListPanel list;
    private static MainPageUiBinder uiBinder = GWT.create(MainPageUiBinder.class);

    interface MainPageUiBinder extends UiBinder {
    }

    public MainPage() {
        initWidget(uiBinder.createAndBindUi(this));

 
 

The solution

 There was a very old version old version of xercesImpl 2.6.2 included by Jersey
       
        
            com.sun.jersey.contribs
            jersey-atom-abdera
            1.8
        

So find it and banish it to the place it came from and don't forget to clean package
 
          
            com.sun.jersey.contribs
            jersey-atom-abdera
            1.8
          
            
              xercesImpl
              xerces
            
          
        
       
 
 
 

1 comment:

  1. Richard Kolb .... this one post saved my life today!

    Been battling with this same error (but not Jersey related, but other Lib with dep on xerces) and was about to throw the computer out of the window when I saw your post.

    Just had to say thanks!

    ReplyDelete