Thursday, September 2, 2010

UiBinder causes build to fail with out of memory

I have a reasonable sized GWT project that compiles fine at the
moment.

I started to look at using UiBinder, initially by incorporating the
simplest "HelloWorld" UiBinder code from the tutorial.

However, it causes my build to fail due to out of memory as shown:

GWT Compiling landing module (silent)
[java] [ERROR] Unexpected
[java] java.lang.OutOfMemoryError: Java heap space
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Class.java:
2427)
[java] at java.lang.Class.getDeclaredMethod(Class.java:1935)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispatch(GenerateJavaAST.java:499)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispProcessExpression(GenerateJavaAST.java:
527)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.addCallArgs(GenerateJavaAST.java:1990)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processExpression(GenerateJavaAST.java:804)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispatch(GenerateJavaAST.java:500)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispProcessExpression(GenerateJavaAST.java:
527)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processBinaryOperation(GenerateJavaAST.java:
2587)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processExpression(GenerateJavaAST.java:888)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispatch(GenerateJavaAST.java:500)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispProcessExpression(GenerateJavaAST.java:
527)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispProcessStatement(GenerateJavaAST.java:
557)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processStatements(GenerateJavaAST.java:1829)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processStatement(GenerateJavaAST.java:1513)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispatch(GenerateJavaAST.java:500)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.dispProcessStatement(GenerateJavaAST.java:
563)
[java] at com.google.gwt.dev.jjs.impl.GenerateJavaAST
$JavaASTGenerationVisitor.processStatement(GenerateJavaAST.java:1712)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] [ERROR] Out of memory; to increase the amount of
memory, use the -Xmx flag at startup (java -Xmx128M ...)


I would accept the "hit" and add the extra memory flag, but I suspect
something more serious must be wrong. Just including these two lines
of code in my java file (QueryModule.java) cause this failure:

interface MyUiBinder extends UiBinder<DivElement, QueryModule> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

commenting them back out again gets me back to normal.

For reference, here is the QueryModule.ui.xml (copied from tutorial)
file:

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'>
<div>
Hello, <span ui:field='nameSpan'/>.
</div>
</ui:UiBinder>

I am using GWT2.0.4 with latest version of Eclipse plug-in.

This code is in a GWT module in a sub-package of my project that is
inherited from the "main" package that is being compiled using GWT
compiler with the following Ant task:

<echo message="GWT Compiling landing module (silent)" />
<java classpathref="project.classpath"
classname="com.google.gwt.dev.Compiler" fork="true"
failonerror="true">
<classpath>
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</classpath>
<arg value="-war" />
<arg value="war" />
<arg value="-logLevel" />
<arg value="ERROR" />
<arg value="com.bcntouch.ta.landing" />
</java>


Any ideas as to what is causing this problem, and how to avoid it so I
can start using UiBinder would be appreciated.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment