does com.google.gwt.dev.Compiler need to run prior to hosted mode?

12 views
Skip to first unread message

pohl

unread,
Apr 13, 2009, 3:31:25 PM4/13/09
to Google Web Toolkit
I have a basic question about what is required in the build process in
order to invoke hosted mode. I'm trying to speed up my compilation
times, and I noticed that the Java-2-Javascript compiler is running
even in the case when I'm debugging in hosted mode.

Now I'm not using the same tools as y'all...no Eclipse for me. I'm
using Netbeans (and the GWT4NB plugin) and I thought that, perhaps,
the ANT scripts could be made more optimal by leaving out the
com.google.gwt.dev.GWTCompiler step.

So, does it have to be there in that case? If so, what does it
accomplish? It's my understanding that hosted mode is interacting
with Java objects...so I have a hard time imagining what purpose it
could serve.

Vitali Lovich

unread,
Apr 13, 2009, 4:24:16 PM4/13/09
to Google-We...@googlegroups.com
No, you don't need it for hosted mode.  The only reason to have that would be to ensure that you are actually writing compilable code (just because it runs under hosted mode doesn't mean it'll compile to Javascript).

Generally though, you don't do that since you want a fast turnaround to hack & test.  The Eclipse projects that GWT creates certainly don't.

Jeff Chimene

unread,
Apr 13, 2009, 4:43:24 PM4/13/09
to Google-We...@googlegroups.com
On 04/13/2009 01:24 PM, Vitali Lovich wrote:
> No, you don't need it for hosted mode. The only reason to have that
> would be to ensure that you are actually writing compilable code (just
> because it runs under hosted mode doesn't mean it'll compile to
> Javascript).
>
> Generally though, you don't do that since you want a fast turnaround
> to hack & test. The Eclipse projects that GWT creates certainly don't.

If you're using -noserver, you do need at least one compile step to
generate the .nocache and other static files. Hosted mode is available
after moving those compilation results (including all images and other
html) to your server. It's not necessary to repeat the compilation each
time. You will need to repeat these recompile/copy steps if there's a
change to the GWT version.

See
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
for more information.

pohl

unread,
Apr 13, 2009, 5:48:08 PM4/13/09
to Google Web Toolkit
Thank you for your responses. I see that the build-gwt.xml ANT
script in my GWT4NB-based project does have a "-noserver" argument in
the block that invokes GWTShell, so at least one compile step is
necessary, as per Jeff's observation, to copy those resources to the
server.

I'm still at a loss in my attempt to understand exactly what
conditions are necessary to get this much-promised "fast turnaround"
in hosted mode. If I stop the debugger and debug my project again
(even if I make absolutely no changes to the source code) the
GWTCompiler runs again. Is this a failing in Netbeans and/or GWT4NB?

Or is my only avenue to try to get the debugger to hot-fix the code
using the "Apply Code Changes" button (in the Netbeans debugger) and
then clicking the "refresh" button in hosted mode?

The reason that I ask this last question is that, even if I make a
trivial change like just changing some text that appears in my
interface, I get an exception when I click "Apply Code Changes". (In
the example below, I merely changed a label on my login panel from
"Username" to "Usern4me" so that I could visually see that the hotfix
was applied):

init:
deps-jar:
Compiling 1 source file to /Users/pohl/Source/CP/trunk/CPLib/build/
classes
Note: /Users/pohl/Source/CP/trunk/CPLib/src/net/nanonation/ui/client/
widget/LoginPanel.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
compile-single:
Classes to be reloaded:
net.nanonation.ui.client.widget.LoginPanel$1
net.nanonation.ui.client.widget.LoginPanel$2
net.nanonation.ui.client.widget.LoginPanel$3
net.nanonation.ui.client.widget.LoginPanel$4
net.nanonation.ui.client.widget.LoginPanel$5
net.nanonation.ui.client.widget.LoginPanel
The virtual machine does not support this operation: delete method not
implemented
/Users/pohl/Source/CP/trunk/CPLib/nbproject/build-impl.xml:475: The
following error occurred while executing this line:
/Users/pohl/Source/CP/trunk/CPLib/nbproject/build-impl.xml:237: The
virtual machine does not support this operation: delete method not
implemented
BUILD FAILED (total time: 0 seconds)






Jeff Chimene

unread,
Apr 13, 2009, 6:38:38 PM4/13/09
to Google-We...@googlegroups.com
On 04/13/2009 02:48 PM, pohl wrote:
> Thank you for your responses. I see that the build-gwt.xml ANT
> script in my GWT4NB-based project does have a "-noserver" argument in
> the block that invokes GWTShell, so at least one compile step is
> necessary, as per Jeff's observation, to copy those resources to the
> server.
>
> I'm still at a loss in my attempt to understand exactly what
> conditions are necessary to get this much-promised "fast turnaround"
> in hosted mode. If I stop the debugger and debug my project again
> (even if I make absolutely no changes to the source code) the
> GWTCompiler runs again. Is this a failing in Netbeans and/or GWT4NB?
>

I'm not a GWT expert, but I'm pretty sure that if you exit hosted mode,
whatever dynamic structures are created to communicate w/ your IDE are
lost. Hence the need to recompile on the next invocation.


> Or is my only avenue to try to get the debugger to hot-fix the code
> using the "Apply Code Changes" button (in the Netbeans debugger) and
> then clicking the "refresh" button in hosted mode?
>
> The reason that I ask this last question is that, even if I make a
> trivial change like just changing some text that appears in my
> interface, I get an exception when I click "Apply Code Changes". (In
> the example below, I merely changed a label on my login panel from
> "Username" to "Usern4me" so that I could visually see that the hotfix
> was applied):
>

Yeah, I've noticed this too, only I haven't had the impetus to ask it of
the list. I just assume that the restart is necessary. Maybe some GWT
pundit knows what we're doing wrong...

Do you know about the <set-property> tag? If not, try adding the
following to your module.gwt.xml file:
<set-property name="user.agent" value="gecko"/>

using the appropriate browser ID for "value". At least you'll only wait
for one permutation rather than the (probably) default five. Don't
forget to remove the tag before compiling for production. I think Vitali
wrote in some earlier discussion describing how to make this
set-property a compile-time decision.

Vitali Lovich

unread,
Apr 13, 2009, 7:00:06 PM4/13/09
to Google-We...@googlegroups.com
On Mon, Apr 13, 2009 at 6:38 PM, Jeff Chimene <jchi...@gmail.com> wrote:

On 04/13/2009 02:48 PM, pohl wrote:
> Thank you for your responses.   I see that the build-gwt.xml ANT
> script in my GWT4NB-based project does have a "-noserver" argument in
> the block that invokes GWTShell, so at least one compile step is
> necessary, as per Jeff's observation, to copy those resources to the
> server.
>
> I'm still at a loss in my attempt to understand exactly what
> conditions are necessary to get this much-promised "fast turnaround"
> in hosted mode.   If I stop the debugger and debug my project again
> (even if I make absolutely no changes to the source code) the
> GWTCompiler runs again.   Is this a failing in Netbeans and/or GWT4NB?
So change the ant script so that it does what you want it to.  I've never gone the noserver route as I've always used the embedded app server (Jetty in 1.6).

>

I'm not a GWT expert, but I'm pretty sure that if you exit hosted mode,
whatever dynamic structures are created to communicate w/ your IDE are
lost. Hence the need to recompile on the next invocation.
In hosted mode, only the Java code needs to be recompiled - no need to run the Javascript compiler (except the 1 time for resources perhaps in noserver mode as was mentioned, although I've never used that mode).

> Or is my only avenue to try to get the debugger to hot-fix the code
> using the "Apply Code Changes" button (in the Netbeans debugger) and
> then clicking the "refresh" button in hosted mode?
>
The refresh button is only necessary if you've changed server code & applying a code change failed (this relaunches your server state, so you'll want to be careful here that you're server can in fact handle this).

> The reason that I ask this last question is that, even if I make a
> trivial change like just changing some text that appears in my
> interface, I get an exception when I click "Apply Code Changes".  (In
> the example below, I merely changed a label on my login panel from
> "Username" to "Usern4me" so that I could visually see that the hotfix
> was applied)
I'm not sure if this feature is compatible between Netbeans & GWT.  It is with Eclipse.

Jeff Chimene

unread,
Apr 13, 2009, 7:29:30 PM4/13/09
to Google-We...@googlegroups.com

Yeah, that must be the issue. When using noserver mode, it must be that
the hosted mode server always wants a restart. ISTR that when I first
started using GWT, hosted mode would "just work" with a press of the
reload. Now that I'm using noserver almost exclusively, the reload of
the hosted mode server is SOP.

Jeff Chimene

unread,
Apr 13, 2009, 7:48:52 PM4/13/09
to Google-We...@googlegroups.com
On 04/13/2009 02:48 PM, pohl wrote:

I don't remember NetBeans well enough to comment on how it interacts w/
hosted mode.

Also, remember that GWT does not implement the entire JRE. From the
looks of the above error, you might be hitting that limitation, i.e.
"delete method not implemented", as well.

pohl

unread,
Apr 14, 2009, 2:12:38 PM4/14/09
to Google Web Toolkit


On Apr 13, 6:48 pm, Jeff Chimene <jchim...@gmail.com> wrote:
>
> Also, remember that GWT does not implement the entire JRE. From the
> looks of the above error, you might be hitting that limitation, i.e.
> "delete method not implemented", as well.

Well, I started with a working application, and only changed the value
of a String. So if it was correctly built before, such a change could
not have introduced new API calls outside of the subset that GWT
supports. It looks to me like that delete method is a problem with
low-level class reloading that may be broken on the current JDK that
comes with MacOS X. I've never seen that before, though.

Vitali Lovich wrote:
>
> So change the ant script so that it does what you want it to. I've never
> gone the noserver route as I've always used the embedded app server (Jetty
> in 1.6).

Alas, this is not possible in my application. Neither Tomcat nor
Jetty are able to deploy EARs, let alone the stateless session beans
and entity beans within them. Therefore "noserver" is my only
option, and therefore no quick-turnaround-via-hosted-mode love for me.

:-/

Jeff Chimene

unread,
Apr 14, 2009, 2:41:15 PM4/14/09
to Google-We...@googlegroups.com

That blows.

Don't forget about the change to MODULE.gwt.xml to reduce the
compilation permutation count. It can make a difference for large values
of LOC,

Tony Strauss

unread,
Apr 15, 2009, 11:03:08 AM4/15/09
to Google Web Toolkit
Perhaps I'm not understanding the previous discussion completely and I
do not use NetBeans, but I do use GWT's hosted mode with the -noserver
option and enjoy the benefits of hosted mode's rapid develop/test
cycle. All it takes for me to see a change in the client code is
hitting the hosted mode browser's reload button.

We use our own ant-based build system. To use hosted mode, we:
1.) Do one compilation of the client code (GWTCompiler)
2.) Compile the server code.
3.) Launch our web server (Jetty, in our case)
4.) Launch hosted mode

After this, hitting reload in hosted mode reflects changes in the
client's source files (we never need to re-run GWTCompiler). Of
course, for changes to the server code, jetty needs to reload the war
(although not for css changes, which also saves time).

Tony
--
Tony Strauss
Designing Patterns, LLC
http://www.designingpatterns.com
http://blogs.designingpatterns.com

Sumit Chandel

unread,
Apr 17, 2009, 2:35:02 PM4/17/09
to Google-We...@googlegroups.com
Hi pohl,

As far as I can tell, this is a GWT4NB limitation. Check out Issue #49 (link below) on the GWT4NB issues list.

Issue #49 (also see issue #39 linked therein):

It looks like a fix is planned for the issue. I recommend posting up your interest in seeing that issue fixed as well to push for a patch.

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages