views:

607

answers:

4

I've been stumped for a while trying to figure out why my GWT demo app isn't working in hosted mode so I went back and downloaded the Google Web Toolkit again, unzipped it and simply went to the samples directory and ran "ant hosted". The hosted browser launches and only shows the static html content but none of the dynamically generated js widgets, etc. However when I click "Compile/Browse" the examples launch correctly in Firefox. What could be wrong with my setup/environment?

A: 

The main difference I can think of is that in the Compile/Browser you are opening the html host page like a regular file, while in the hosted mode (even in a client sample) it has to be provided by the http server via localhost:8080. Check if the server is beeing started.

ciczan
When you run in hosted mode, it starts an embedded jetty server. There's shouldn't be a need to run an external http server on localhost:8080. However, you can deploy the gwt app to a war, and then deploy the war to an externally running server (tomcat or jetty or whatever).
Dave Paroulek
A: 

I followed the link you provided to download gwt. Extracted and ran "ant hosted" under samples/Hello, samples/DynaTable, and samples/Showcase and they all worked successfully. I'm also running Windows XP and java 1.6.0_11.

I think that running "ant hosted" starts an embedded Jetty server that listens on port 8888. Hosted Mode Browser makes requests to that embedded server, for example: http://localhost:8888/Showcase.html.

Also, when you click "Compile/Browse", it opens your default Browser (in my case it's firefox) and it tries to make a request to the same embedded jetty server that the hosted mode browser uses.

So, if it works in your browser, then the browser is connecting to the embedded jetty server. It's very strange that hosted mode doesn't work properly but you're able to view in a browser.

I believe the difference here is that hosted mode runs pure java (some sort of javascript emulator, I'm not sure I understand 100%), while the browser is running javascript.

So, I suggest troubleshooting the jvm that is started when "ant hosted" is run. Maybe the jvm is running out of memory or something when you load it up in hosted mode browser? Maybe you can pass some jvm args to the ant script to fix the problem?

Sorry I can't be more specific, that's a strange one!

Dave Paroulek
A: 

@Chris: I suspect this question may have something to do with your earlier question if it is on the same computer that you were using. The solution may be to clear your IE cache because it tends to cache the 'script' tag contents and when it got messed up earlier while you were importing other stuff, it may still be sitting around in IE. Found the potential answer at this link.

Thimmayya
A: 

I created a new workspace, re-imported everything and used GWT 1.6.x instead (because Ext GWT 2.X, which I need for this project requires GWT 1.6.x). This did the trick... everything works ok now.

Chris Tek