hosted mode debugging with -noserver in eclipse

82 views
Skip to first unread message

mike_mac

unread,
Oct 7, 2009, 6:02:57 AM10/7/09
to Google Web Toolkit
Hi ...
I'm trying to get hosted mode debugging running using Jboss as the
server instead of tomcat and I can't get it working ...

I've followed the instructions here ...
http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT%27s

But when I try to run the google web tool kit development shell with
eclipse I'm getting
[ERROR] Unable to find 'main.gwt.xml' on your classpath; could be a
typo, or maybe you forgot to include a classpath entry for source?

I've specified Main as my entry point module in the gwt tab of the
launch configuration. Yes I did notice the case difference in the
name, the module definition was changed to main with
<module rename-to="main"> and the url was <context-root>/main/
main.html ...
I've tried renamining the gwt.xml to main.gwt.xml but that had no
effect.

The root src dir with the gwt.xml is on the classpath (in the
classpath tab).

I've tried explcitly setting the directory with the Main.gwt.xml into
the classpath which does indeed let eclipse/gwt find the xml file but
then I get lots of errors along the lines of

The declared package
"com.company.product.web.client.uicomponent.menu" does not match the
expected package "client.uicomponent.menu"

I'm stumped ... could it be the rename-to="main" thats confusing it ?
anyone with any ideas ?

I'm able to run some sample projects in the embedded server no problem
so I can only think that its something to do with running in -noserver
option but I'm lost.

I'm using "Google App Engine for Java 1.2.5 SDK Bundle for Eclipse
3.5" with GWT 1.7

Everything compiles with Maven and runs ok on JBoss ...

mike_mac

unread,
Oct 7, 2009, 12:12:38 PM10/7/09
to Google Web Toolkit
Just to follow up on this ... this seems to be the eclipse plugin,
I've managed to get host mode running from the command line and it
works.

The weird thing is, it DOES work with a small war project that I
built, deployed on jboss and ran the hosted mode -noserver option from
eclipse via the plugin. Our more complicated maven built war (part of
a larger ear) doesn't and it seems to classpath issue but I don't know
how to debug the eclipse plugin.

I've added the command line startup command into my eclipse run so I
can debug but it would be better if the plugin worked :(

I did notice that the usage for plugin was different from commandline
options so there could well be a bug here (i.e. theres a possiblity
I'm not going mad). GWTShell vs HostedMode ??

Unknown argument: -blah
Google Web Toolkit 1.7.0
GWTShell [-noserver] [-port port-number | "auto"] [-whitelist
whitelist-string] [-blacklist blacklist-string] [-logLevel level] [-
gen dir] [-style style] [-ea] [-out dir] [url]

where
-noserver Prevents the embedded web server from running
-port Specifies the TCP port for the embedded web server
(defaults to 8888)
-whitelist Allows the user to browse URLs that match the specified
regexes (comma or space separated)
-blacklist Prevents the user browsing URLs that match the specified
regexes (comma or space separated)
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE,
DEBUG, SPAM, or ALL
-gen The directory into which generated files will be written
for review
-style Script output style: OBF[USCATED], PRETTY, or DETAILED
(defaults to OBF)
-ea Debugging: causes the compiled output to check assert
statements.
-out The directory to write output files into (defaults to
current)
and
url Automatically launches the specified URL

versus

java -cp gwt-dev-<your platform here>.jar
com.google.gwt.dev.HostedMode
Missing required argument 'module[s]'
Google Web Toolkit 1.7.0
HostedMode [-noserver] [-port port-number | "auto"] [-whitelist
whitelist-string
] [-blacklist blacklist-string] [-logLevel level] [-gen dir] [-style
style] [-ea
] [-server servletContainerLauncher] [-startupUrl url] [-war dir] [-
extra dir] [
-workDir dir] [-localWorkers count] module[s]

where
-noserver Prevents the embedded web server from running
-port Specifies the TCP port for the embedded web server
(defaults to 8888)
-whitelist Allows the user to browse URLs that match the
specified regexes (comma or space separated)
-blacklist Prevents the user browsing URLs that match the
specified regexes (comma or space separated)
-logLevel The level of logging detail: ERROR, WARN, INFO,
TRACE, DEBUG, SPAM, or ALL
-gen The directory into which generated files will be
written for review
-style Script output style: OBF[USCATED], PRETTY, or
DETAILED (defaults to OBF)
-ea Debugging: causes the compiled output to check assert
statements.
-server Specifies a different embedded web server to run
(must implement ServletContainerLauncher)
-startupUrl Automatically launches the specified URL
-war The war directory to write output files into
(defaults to war)
-extra The directory into which extra, non-deployed files
will be written
-workDir The compiler work directory (must be writeable;
defaults to a system temp dir)
-localWorkers Specifies the number of local workers to use when
compiling permutations
and
module[s] Specifies the name(s) of the module(s) to host


On Oct 7, 11:02 am, mike_mac <michael.mac...@gmail.com> wrote:
> Hi ...
>    I'm trying to get hosted mode debugging running using Jboss as the
> server instead of tomcat and I can't get it working ...
>
> I've followed the instructions here ...http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.h...

Keith Platfoot

unread,
Oct 8, 2009, 11:38:07 AM10/8/09
to google-we...@googlegroups.com
Hi Mike,

I think your issue has to do with certain changes made to GWT in version 1.6.  Before 1.6, the GWTShell class was used to launch applications in hosted mode.  In 1.6, the default structure of GWT projects was changed to make it more similar to Java web apps.  By convention, GWT projects now assume the existence of a directory named "war" which contains the contents of the deployed WAR file.  This includes source files, such as your web.xml and any public HTML pages.  The WAR directory also contains subdirectories with the compiled JavaScript output of each GWT module.  In 1.6 and later a new class, HostedMode, replaces the older GWTShell as the default class for launching hosted mode.

The plugin supports GWT versions both older and newer than 1.6.  It uses some heuristics to determine whether to launch applications with the GWTShell or HostedMode class.  It sounds like in your case, you are able to use HostedMode from the command line, but when you launch from Eclipse, the plugin is using GWTShell... is that correct?

If so, I have two follow-up questions.  First, does your project contain a WAR directory named "war"?  I know that many maven users use a different naming convention, but as of right now, the plugin does not support configuring the name of the WAR directory (it must be "war").  If yours is named differently, your best bet might be to try to create a symlink named "war" pointing to your actual WAR folder.  I haven't actually tested that scenario, but it *should* work.

Once your project has a proper "war" directory (or symlink), the second thing to check is whether your project is tagged as a Google Web Application project.  This won't actually show up in the Eclipse UI, but if you look at your project's .project file, you should see the following tag nested under <natures>

<nature>com.google.gdt.eclipse.core.webAppNature</nature>

If it's not there, go ahead and add it, and then restart Eclipse.  Then try launching the project again, and see what happens.  Let me know if you still run into problems.

Keith

mike_mac

unread,
Oct 9, 2009, 6:37:21 AM10/9/09
to Google Web Toolkit

Wow ... thanks for explaining that, at least I know I wasn't going
crazy !
Maybe a small fix to look for the Maven default dir (webapp) in a
future release ? :-)
Actually it works fine when launched as a java application from inside
eclipse,
it just means I have to manage the dependent jars manually. Being able
to
make a change and just hit refresh is awesome !

On Oct 8, 4:38 pm, Keith Platfoot <kplatf...@google.com> wrote:
> Hi Mike,
> I think your issue has to do with certain changes made to GWT in version
> 1.6.  Before 1.6, the GWTShell class was used to launch applications in
> hosted mode.  In 1.6, the default structure of GWT projects was changed to
> make it more similar to Java web apps.  By convention, GWT projects now
> assume the existence of a directory named "war" which contains the contents
> of the deployed WAR file.  This includes source files, such as your web.xml
> and any public HTML pages.  The WAR directory also contains subdirectories
> with the compiled JavaScript output of each GWT module.  In 1.6 and later a
> new class, HostedMode, replaces the older GWTShell as the default class for
> launching hosted mode.
>
> The plugin supports GWT versions both older and newer than 1.6.  It uses
> some heuristics to determine whether to launch applications with the
> GWTShell or HostedMode class.  It sounds like in your case, you are able to
> use HostedMode from the command line, but when you launch from Eclipse, the
> plugin is using GWTShell... is that correct?
>
> If so, I have two follow-up questions.  First, does your project contain a
> WAR directory named "war"?  I know that many maven users use a different
> naming convention, but as of right now, the plugin does *not* support
> configuring the name of the WAR directory (it must be "war").  If yours is
> named differently, your best bet might be to try to create a symlink named
> "war" pointing to your actual WAR folder.  I haven't actually tested that
> scenario, but it *should* work.
>
> Once your project has a proper "war" directory (or symlink), the second
> thing to check is whether your project is tagged as a Google Web Application
> project.  This won't actually show up in the Eclipse UI, but if you look at
> your project's .project file, you should see the following tag nested under
> <natures>
>
> <nature>com.google.gdt.eclipse.core.webAppNature</nature>
>
> If it's *not *there, go ahead and add it, and then restart Eclipse.  Then
> try launching the project again, and see what happens.  Let me know if you
> still run into problems.
>
> Keith
>
Reply all
Reply to author
Forward
0 new messages