English 中文(简体)
GWT s hosted mode not working
原标题:

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?

最佳回答

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.

问题回答

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!

@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.

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.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签