Invalid version number "2.0" passed to external.gwtOnLoad()

151 views
Skip to first unread message

Fred Sauer

unread,
Aug 11, 2009, 7:50:14 PM8/11/09
to Google Web Toolkit Contributors
When switching GWT versions on my project I get this error (when I'm lucky):
[ERROR] Invalid version number "2.0" passed to external.gwtOnLoad(), expected "1.6"; your hosted mode bootstrap file may be out of date; if you are using -noserver try recompiling and redeploying your app

However, if I'm switching within a given version of GWT (say because I'm working off of trunk and updating or rolling back) I may in fact have incorrect contents in hosted.html but a correct version. This means the above error message is never thrown, but hosted mode is unexplainably broken.

Should this be an issue? It would be great if GWT checked the contents of hosted.html and replaced the file if needed.

Thoughts?

--
Fred Sauer
Developer Advocate
G
ooglInc.
1600 Amphitheatre Parkway
Mountain View, CA 94043
fre...@google.com



John Tamplin

unread,
Aug 11, 2009, 8:14:23 PM8/11/09
to Google-Web-Tool...@googlegroups.com
On Tue, Aug 11, 2009 at 7:50 PM, Fred Sauer <fre...@google.com> wrote:
When switching GWT versions on my project I get this error (when I'm lucky):
[ERROR] Invalid version number "2.0" passed to external.gwtOnLoad(), expected "1.6"; your hosted mode bootstrap file may be out of date; if you are using -noserver try recompiling and redeploying your app

However, if I'm switching within a given version of GWT (say because I'm working off of trunk and updating or rolling back) I may in fact have incorrect contents in hosted.html but a correct version. This means the above error message is never thrown, but hosted mode is unexplainably broken.

Should this be an issue? It would be great if GWT checked the contents of hosted.html and replaced the file if needed.

I'm not sure I understand the issue.  If you have different versions of hosted.html and GWT, things are likely to not work and that is why that check was added in 1.6.  I don't see how you could have the incorrect contents of hosted.html but the correct version, unless you update/rollback parts of GWT separately, in which case you are already likely to break things if you don't know what you are doing.

In the -noserver case, GWT never sees the hosted.html your web server serves, and the version number is passed to the plugin from hosted.html (or gwt.external in legacy hosted mode) -- it could conceivably do an XHR for hosted.html and send the entire contents (or a hash) rather than just the version number, but that seems overkill as I don't see a reasonable way the version number contained in the hosted.html file will get out of sync with the rest of the hosted.html file.
 
--
John A. Tamplin
Software Engineer (GWT), Google

Fred Sauer

unread,
Aug 11, 2009, 8:22:10 PM8/11/09
to Google-Web-Tool...@googlegroups.com
On Tue, Aug 11, 2009 at 5:14 PM, John Tamplin <j...@google.com> wrote:
On Tue, Aug 11, 2009 at 7:50 PM, Fred Sauer <fre...@google.com> wrote:
When switching GWT versions on my project I get this error (when I'm lucky):
[ERROR] Invalid version number "2.0" passed to external.gwtOnLoad(), expected "1.6"; your hosted mode bootstrap file may be out of date; if you are using -noserver try recompiling and redeploying your app

However, if I'm switching within a given version of GWT (say because I'm working off of trunk and updating or rolling back) I may in fact have incorrect contents in hosted.html but a correct version. This means the above error message is never thrown, but hosted mode is unexplainably broken.

Should this be an issue? It would be great if GWT checked the contents of hosted.html and replaced the file if needed.

I'm not sure I understand the issue.  If you have different versions of hosted.html and GWT, things are likely to not work and that is why that check was added in 1.6.  I don't see how you could have the incorrect contents of hosted.html but the correct version, unless you update/rollback parts of GWT separately, in which case you are already likely to break things if you don't know what you are doing.

Yep, that's exactly the scenario :). Knowing that you have to watch out for this stuff is one thing. Being bit by it every now and again and going down a rabbit hole, is (mildly) annoying.

Not a huge deal as this affect contributors only, but could be a good sanity check to save time down the road.

Thanks
Fred


 
In the -noserver case, GWT never sees the hosted.html your web server serves, and the version number is passed to the plugin from hosted.html (or gwt.external in legacy hosted mode) -- it could conceivably do an XHR for hosted.html and send the entire contents (or a hash) rather than just the version number, but that seems overkill as I don't see a reasonable way the version number contained in the hosted.html file will get out of sync with the rest of the hosted.html file.
 
--
John A. Tamplin
Software Engineer (GWT), Google


John Tamplin

unread,
Aug 11, 2009, 8:47:51 PM8/11/09
to Google-Web-Tool...@googlegroups.com
On Tue, Aug 11, 2009 at 8:22 PM, Fred Sauer <fre...@google.com> wrote:
I'm not sure I understand the issue.  If you have different versions of hosted.html and GWT, things are likely to not work and that is why that check was added in 1.6.  I don't see how you could have the incorrect contents of hosted.html but the correct version, unless you update/rollback parts of GWT separately, in which case you are already likely to break things if you don't know what you are doing.

Yep, that's exactly the scenario :). Knowing that you have to watch out for this stuff is one thing. Being bit by it every now and again and going down a rabbit hole, is (mildly) annoying.

Not a huge deal as this affect contributors only, but could be a good sanity check to save time down the road.

There are so many ways you can screw things up by mixing different versions of parts of GWT, I don't see how this is any different.  For example, if you rollback an old TypeOracleMediator but don't roll back related TypeOracle changes, things are going to break horribly.  I think trying to add code inside GWT to detect such situations is counterproductive and unlikely to be effective anyway.

I would hope that anyone knows building a version of GWT that is not at a consistent revision across the board means they better know exactly what they are doing or they will get weird breakages.

Fred Sauer

unread,
Aug 12, 2009, 12:33:06 AM8/12/09
to Google-Web-Tool...@googlegroups.com
On Tue, Aug 11, 2009 at 5:47 PM, John Tamplin <j...@google.com> wrote:
On Tue, Aug 11, 2009 at 8:22 PM, Fred Sauer <fre...@google.com> wrote:
I'm not sure I understand the issue.  If you have different versions of hosted.html and GWT, things are likely to not work and that is why that check was added in 1.6.  I don't see how you could have the incorrect contents of hosted.html but the correct version, unless you update/rollback parts of GWT separately, in which case you are already likely to break things if you don't know what you are doing.

Yep, that's exactly the scenario :). Knowing that you have to watch out for this stuff is one thing. Being bit by it every now and again and going down a rabbit hole, is (mildly) annoying.

Not a huge deal as this affect contributors only, but could be a good sanity check to save time down the road.

There are so many ways you can screw things up by mixing different versions of parts of GWT, I don't see how this is any different.  For example, if you rollback an old TypeOracleMediator but don't roll back related TypeOracle changes, things are going to break horribly.  I think trying to add code inside GWT to detect such situations is counterproductive and unlikely to be effective anyway.

You had me at "There are so many ways you can screw things up"

Thanks
Fred

I would hope that anyone knows building a version of GWT that is not at a consistent revision across the board means they better know exactly what they are doing or they will get weird breakages.


--
John A. Tamplin
Software Engineer (GWT), Google


Ray Ryan

unread,
Aug 12, 2009, 11:52:53 AM8/12/09
to Google-Web-Tool...@googlegroups.com
We could make the error message a bit more helpful. If I'm following the conversation correctly I think I've bumped into this due to browser caching. Suggesting that possibility in the error message, or offering a link to force a reload in a browser busting way (e.g. adding a query param wtih a date stamp value) could save folks a lot of time.

Marko Vuksanovic

unread,
Sep 18, 2009, 8:37:19 AM9/18/09
to Google Web Toolkit Contributors
I had the same problem.. After struggling for 2 days I figured out
that the embedded jetty loads the hosted.html file form cache (C:
\Documents and Settings\YOUR_USERNAME\Local Settings\Temporary
Internet Files\Content.IE5 - on windows xp) - after manually deleting
that cache everything started working normally.

Hope this saves somebody else at least 2 days :)

Miguel Méndez

unread,
Sep 21, 2009, 12:51:41 PM9/21/09
to google-web-tool...@googlegroups.com
I've also run into this problem...
--
Miguel

Ray Ryan

unread,
Sep 21, 2009, 1:06:24 PM9/21/09
to google-web-tool...@googlegroups.com, John Tamplin, Amit Manjhi
Where does the error message live? This seems like the perfect time to make it a bit more helpful, even if it just suggests to people that they check for both browser and server caching.

2009/9/21 Miguel Méndez <mme...@google.com>

John Tamplin

unread,
Sep 21, 2009, 1:26:47 PM9/21/09
to Ray Ryan, google-web-tool...@googlegroups.com, Amit Manjhi
On Mon, Sep 21, 2009 at 1:06 PM, Ray Ryan <rj...@google.com> wrote:
Where does the error message live? This seems like the perfect time to make it a bit more helpful, even if it just suggests to people that they check for both browser and server caching.
 
HostedHtmlVersion.validHostedHtmlVersion

Rajeev Dayal

unread,
Sep 21, 2009, 3:17:21 PM9/21/09
to google-web-tool...@googlegroups.com, Ray Ryan, Amit Manjhi
Could we modify the hosted mode servlet so that it set the appropriate no-cache headers on hosted.html? I've also run into this issue due to browser caching.

Also, is this file re-generated every time hosted mode is started up? If not, it definitely should be.

John Tamplin

unread,
Sep 21, 2009, 3:32:32 PM9/21/09
to google-web-tool...@googlegroups.com, Ray Ryan, Amit Manjhi
On Mon, Sep 21, 2009 at 3:17 PM, Rajeev Dayal <rda...@google.com> wrote:
Could we modify the hosted mode servlet so that it set the appropriate no-cache headers on hosted.html? I've also run into this issue due to browser caching.

Also, is this file re-generated every time hosted mode is started up? If not, it definitely should be.

I have a change out for review but we didn't appear to reach consensus on what it should do. 

Ray Ryan

unread,
Sep 21, 2009, 3:38:25 PM9/21/09
to John Tamplin, google-web-tool...@googlegroups.com, Amit Manjhi
Time to put it up on rietveld again? Or is there already an url?

John Tamplin

unread,
Sep 21, 2009, 3:47:42 PM9/21/09
to Ray Ryan, google-web-tool...@googlegroups.com, Amit Manjhi
On Mon, Sep 21, 2009 at 3:38 PM, Ray Ryan <rj...@google.com> wrote:
Time to put it up on rietveld again? Or is there already an url?

Alex Bertram

unread,
Oct 6, 2009, 11:46:17 AM10/6/09
to Google Web Toolkit Contributors
Thank you Marko!! This was starting to feel like a 2 day problem!!

Best,

Alex

On Sep 18, 2:37 pm, Marko Vuksanovic <markovuksano...@gmail.com>
wrote:

Miguel Méndez

unread,
Oct 7, 2009, 11:29:51 AM10/7/09
to google-web-tool...@googlegroups.com
Here is some more information.  I ran into this problem while testing the plugin against GWT 1.7, trunk, and 2.0 MS1.

It looks like whenever we generate the hosted.html we use the timestamp of that file as it was inside of the gwt-dev-PLAT.jar.  It would seem to me that we want to touch that file every time it is copied/generated.
--
Miguel

alexandrupop

unread,
Oct 7, 2009, 10:37:04 AM10/7/09
to Google Web Toolkit Contributors
Had the same problem on Mac. I fixed it by removing Safari cache from /
Library/Caches.

On Sep 18, 3:37 pm, Marko Vuksanovic <markovuksano...@gmail.com>
wrote:

Sky

unread,
Oct 7, 2009, 1:15:43 PM10/7/09
to Google Web Toolkit Contributors
I get this error when I switch from the GWT compiled from Trunk back
to 1.7.1 or any previous versions.

I only know two ways to solve it:

1) Open up war\projectname\hosted.html and edit line 16 from
var $hostedHtmlVersion="2.0";
to
var $hostedHtmlVersion="1.6";

(which I think is a terrible hack because I don't know what other
differences there could be in that file or for that matter the entire
project that isn't being correctly changed back to the previous
version...)

2) Create a whole new project from scratch that is using GWT 1.7.1 and
copy all my files from the broken project into this new one and scrap
the broken one. This just seems dumb.

So why can't I switch between GWT Trunk and the "stable" version
seamlessly?

It has nothing to do with browser caching because the actual
hosted.html file in the project has the value 2.0 instead of 1.6. I
did try clearing the browser cache though.

Any help would be very much appreciated.

On Oct 7, 10:29 am, Miguel Méndez <mmen...@google.com> wrote:
> Here is some more information.  I ran into this problem while testing the
> plugin against GWT 1.7, trunk, and 2.0 MS1.
> It looks like whenever we generate the hosted.html we use the timestamp of
> that file as it was inside of the gwt-dev-PLAT.jar.  It would seem to me
> that we want to touch that file every time it is copied/generated.
>
> On Mon, Sep 21, 2009 at 3:47 PM, John Tamplin <j...@google.com> wrote:
> > On Mon, Sep 21, 2009 at 3:38 PM, Ray Ryan <rj...@google.com> wrote:
>
> >> Time to put it up on rietveld again? Or is there already an url?
>
> > Same one is still there -http://gwt-code-reviews.appspot.com/56807/show

Miguel Méndez

unread,
Oct 7, 2009, 1:27:45 PM10/7/09
to google-web-tool...@googlegroups.com
I entered the issue 4112, to track this problem.

2009/10/7 Miguel Méndez <mme...@google.com>



--
Miguel

Miguel Méndez

unread,
Oct 7, 2009, 1:35:14 PM10/7/09
to google-web-tool...@googlegroups.com
This is definitely a bug and you should be able to switch between the two versions.

As a work around try the following:
1) Delete the current war/MODULE/hosted.html file
2) Re-run hosted mode and see the failure and stop hosted mode (this causes a new hosted.html file with the right version to be generated).
3) Touch the newly generated war/MODULE/hosted.html file.
4) Relaunch hosted mode (this should succeed)

--
Miguel

Sky

unread,
Oct 7, 2009, 6:50:51 PM10/7/09
to Google Web Toolkit Contributors
Hmm, I just tried changing between 3 different versions (trunk, 1.7.1
and 2.0MS1) and it worked flawlessly; no error. The hosted.html file
has maintained "2.0" for that variable through each change.

The only thing I can think of that fixed it is that I closed Eclipse
and launched it again before trying this once more. Well, I did also
try what you suggested by renaming the hosted.html file and it did
generate it again. I doubt that changed anything because the only
difference between the newly generated file and the old file was the
$hostedHtmlVersion variable. Like I said it had the value of "2.0"
when I switched to Trunk and it seemed to want it to be "1.6" when
switching to GWT1.7.1 but now all 3 versions are fine with it as "2.0"

So if there is still a bug I have no idea, but hopefully my
verboseness will assist you guys in finding/dismissing its existence.
Reply all
Reply to author
Forward
0 new messages