How do I set GWT headless mode for Maven?

887 views
Skip to first unread message

laredotornado

unread,
Dec 5, 2011, 5:12:38 PM12/5/11
to Google Web Toolkit
Hi,

I'm using Maven 3.0.3, GWT 2.4 and the Bamboo integration suite. How
do I set up my GWT tests to run in headless mode using Maven and GWT?
I have tried setting both these environment variables ...

JAVA_OPTS="-Djava.awt.headless=true"
MAVEN_OPTS="-Djava.awt.headless=true"

but to no avail. I still get the errors below ...

Caused by: java.lang.RuntimeException: Deferred binding failed for
'com.myco.clearing.product.client.resource.Resources$Images' (did you
forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:
53)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at
com.myco.clearing.product.client.resource.Resources.<clinit>(Resources.java:
38)
... 41 more
Caused by: java.lang.Exception: java.lang.InternalError: Can't connect
to X11 window server using 'localhost:0.0' as the value of the DISPLAY
variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access
$100(X11GraphicsEnvironment.java:52)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:
155)
at java.security.AccessController.doPrivileged(Native Method)
at
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:
131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:
68)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:
1135)
at
com.google.gwt.resources.rg.ImageBundleBuilder.toPng(ImageBundleBuilder.java:
538)
at
com.google.gwt.resources.rg.ImageResourceGenerator.reencodeToTempFile(ImageResourceGenerator.java:
641)
at
com.google.gwt.resources.rg.ImageResourceGenerator.prepare(ImageResourceGenerator.java:
567)
at
com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:
1043)
at
com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:
1069)
at
com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.generateIncrementally(AbstractClientBundleGenerator.java:
412)
at
com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:
647)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:
41)
at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.rebind(StandardRebindOracle.java:78)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:
268)
at
com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:
141)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:
455)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:
49)

Any ideas how and where I set the GWT headless mode for Maven-GWT? -
Dave

Ed

unread,
Dec 6, 2011, 4:19:09 AM12/6/11
to Google Web Toolkit
I understand from the GWT FAQ that this isnt' possible with
ImageBundles.
See:
http://code.google.com/webtoolkit/doc/1.6/FAQ_Troubleshooting.html

laredotornado

unread,
Dec 6, 2011, 8:47:47 AM12/6/11
to Google Web Toolkit
I understand that it says "if you're using any widgets that use
ImageBundle in their underlying implementations, the GWT compiler will
search for the DISPLAY environment variable and try to connect to an
X11 Graphics Window" but then it lists the work-around after, but
you're saying the work-around never applies for ImageBundles? I
didn't get that from reading this section.

What is the alternative? - Dave

Ed

unread,
Dec 6, 2011, 9:05:37 AM12/6/11
to Google Web Toolkit
> you're saying the work-around never applies for ImageBundles?  I
> didn't get that from reading this section.
I think so.
Especially because of this sentence in the faq:
--- Even if you are not using the ImageBundle explicitly in your
client code, ...

I think it's understandable that it always needs the graphics lib's to
modify the images, such that it always needs them when it encounter
images.

BTW: In my test environment I do proxy my ClienbBundle classes (I
don't use GWTTestCase, I hate it ;) ).
- Ed

Thomas Broyer

unread,
Dec 6, 2011, 11:26:30 AM12/6/11
to google-we...@googlegroups.com
Have you tried -Dgwt.extraJvmArgs="-Djava.awt.headless=true"?

Helmers

unread,
Jun 20, 2013, 5:13:23 AM6/20/13
to google-we...@googlegroups.com
This worked for me in GWT 2.5.1 / maven 3.0.4:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <id>gwt-test</id>
                        <phase>integration-test</phase>
                        <configuration>
                            <!-- http://mojo.codehaus.org/gwt-maven-plugin/test-mojo.html -->
                            <includes>**/*GwtTest.java</includes>
                            <extraJvmArgs>-Djava.awt.headless=true -Xmx512m</extraJvmArgs>
                            <mode>htmlunit</mode>
                            <htmlunit>FF3,IE7</htmlunit>
                            <productionMode>false</productionMode>
                            <logLevel>ALL</logLevel>
                            <testTimeOut>120</testTimeOut>
                            <timeOut>120</timeOut>
                        </configuration>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
Reply all
Reply to author
Forward
0 new messages