gwt-dev.jar and embedded Tomcat; Conflicts!

114 views
Skip to first unread message

WulfgarPro

unread,
Jun 16, 2011, 4:57:42 AM6/16/11
to Google Web Toolkit
Hi,

I am using GWT-2.2.0 with NetBeans 7 and Tomcat 7.0.11.

In my unit testing I am using embedded Tomcat (see excepts below).

public static void startTomcatInstance() throws
MalformedURLException, LifecycleException {
tomcat = new Tomcat();

tomcat.setBaseDir(".");
tomcat.setPort(8084);

Context ctx = tomcat.addWebapp(null, "/AdiibHarmoniser",
System.getProperty("user.dir") + "/build/web");
File contextFile = new File(System.getProperty("user.dir") + "/
build/web/META-INF/context.xml");
ctx.setConfigFile(contextFile.toURI().toURL());

URL location =
Context.class.getProtectionDomain().getCodeSource().getLocation();
System.out.println(location.getPath());

tomcat.enableNaming();
tomcat.start();
}

@AfterClass
public static void tearDownClass() throws LifecycleException {
if (tomcat.getServer() != null
&& tomcat.getServer().getState() !=
LifecycleState.DESTROYED) {
if (tomcat.getServer().getState() !=
LifecycleState.STOPPED) {
tomcat.stop();
}
tomcat.destroy();
}
}

I am also unit testing my view class with GWTTestCase. GWTTestCase
requires gwt-dev.jar to be on my CP. Adding gwt-dev.jar causes the
following aforementioned lines to break:

- ctx.setConfigFile(contextFile.toURI().toURL()); -- setConfigFile
only accepts a String
- tomcat.getServer().getState() -- does not exist

Additionally, having the Tomcat jar's on my CP causes the GWTTestCase
to fail with:

java.lang.NoSuchFieldError: warningThreshold at
com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:
340) at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.
(JdtCompiler.java:174) at
com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:616)
at com.google.gwt.dev.javac.CompilationStateBuilder
$CompileMoreLater.compile(CompilationStateBuilder.java:193) at
com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:
390) at
com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:
275) at
com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:
325) at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1322) at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1289) at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:631)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:
441) at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:
296)

Removing the Tomcat jar's enables GWTTestCase to work.. but my
embedded Tomcat then fails.

This is extremley frustrating. I have tried various things (including
repackaging gwt-dev.jar)..

Any ideas ?

WulfgarPro

Juan Pablo Gardella

unread,
Jun 16, 2011, 10:48:01 AM6/16/11
to google-we...@googlegroups.com
You don't must pack gwt-dev. Is only for compilation.

2011/6/16 WulfgarPro <wulfgar.pro@gmail.com>

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


WulfgarPro

unread,
Jun 16, 2011, 11:48:14 PM6/16/11
to Google Web Toolkit
When I say "repackaged", I meant that I have extracted all the files
from the "packaged" jar, removed the jasper content (read about this
being a possible problem here:
http://code.google.com/p/google-web-toolkit/issues/detail?id=5290&can=8&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars)
and then "repackaged" the jar.

This had no effect.

WulfgarPro

On Jun 16, 7:48 pm, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
wrote:
> You don't must pack gwt-dev. Is only for compilation.
>
> 2011/6/16 WulfgarPro <wulfgar....@gmail.com>

WulfgarPro

unread,
Jun 16, 2011, 11:49:01 PM6/16/11
to Google Web Toolkit
Note that I am using NetBeans 7.0

On Jun 16, 7:48 pm, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
wrote:
> You don't must pack gwt-dev. Is only for compilation.
>
> 2011/6/16 WulfgarPro <wulfgar....@gmail.com>
> > com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationSta teBuilder.java:
> > 390) at
>
> > com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationState Builder.java:

Thomas Broyer

unread,
Jun 17, 2011, 8:55:42 AM6/17/11
to google-we...@googlegroups.com
Why are you running client-side unit tests (GWTTestCase) and server-side unit tests or integration tests (the ones using your embedded Tomcat) with the same classpath?
*That*, in my opinion, is the issue.
Reply all
Reply to author
Forward
0 new messages