为什么 GWT 有时会成功编译,有时却停滞不前?
我正在为客户制作一个演示,展示 GWT-Ext for GWT 的功能。在浏览了最简单的启动和运行方法后,我决定安装 Google Plugin for Eclipse 并使用新建 Web 应用程序向导。
第一次,我按照以下步骤创建默认应用程序:
- “选定的文件”>“新的> Eclipse 菜单中的 Web 应用程序项目。
- 在新建 Web 应用程序项目向导中,输入项目名称 (ExtDemo) 和 java 包名称 com.extdemo。
- 取消选中“使用 Google App Engine”复选框。
- 单击“完成”。
- 在包资源管理器中右键单击它并选择“运行方式”>运行配置
- 选中自动选择未使用的端口复选框。
- 单击“运行”以查看默认的 GWT 1.7 应用程序
这工作正常...它启动了 GWT 的托管浏览器并且应用程序按预期工作。
(然后我继续导入 GWT-Ext 并添加各种小部件,构建一个漂亮的小演示应用程序)
但是,在托管模式下重新启动应用程序时,托管浏览器会显示一个空的 iframe。我什至将代码恢复到一切正常工作的状态,并且...同样的事情,一个空的 iframe 以及周围的静态内容。
现在真正奇怪的是,当我按照上述步骤再次完成创建默认应用程序的过程时,托管浏览器再次以空的 iframe 启动。
但是,当我单击“编译/浏览”时,有时允许应用程序在 Firefox 中启动。
有人遇到过这种情况吗?
I am working on a demo for a client of what's possible with GWT-Ext for GWT. After browsing for the simplest way to get up and running, I decided on installing the Google Plugin for Eclipse and using the New Web Application Wizard.
First time around, I followed these steps for create the default application:
- Selected File > New > Web Application Project from the Eclipse menu.
- In the New Web Application Project wizard, entered a name for the project (ExtDemo) and a java package name, com.extdemo.
- Unchecked the "Use Google App Engine" check box.
- Clicked Finish.
- Right clicked it in package explorer and selected Run As > Run Configurations
- Put a check in the Automatically Select Unused Port checkbox.
- Clicked Run to see the default GWT 1.7 application
This worked fine... it launched GWT's hosted browser and the app worked as supposed to.
(I then continued to import GWT-Ext and add all sorts of widgets building up a nice little demo app)
However at some point when relaunching the app in hosted mode, the hosted browser displays an empty iframe. I even reverted the code to a point where everything was working as supposed to and... same thing, an empty iframe with the surrounding static content.
Now what is really strange is when I go through the process of creating the default application again by following the steps above, the hosted browser launches with an empty iframe again.
However when I click on Compile/Browse, this sometimes allows the app to launch in Firefox.
Anyone have this happen to them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我偶尔会看到一些奇怪的行为。以下是一些基本建议(有些是愚蠢的,您可能已经尝试过):
尝试重新使用固定端口,这样就不可能同时运行多个服务器。
更新:找到了一个新的“经典”解决方案:
删除 IE 中的缓存,也可能删除 Firefox 中的缓存。显然,“script”标签内容往往被 IE 缓存。如果这有效,我们都可以尝试一下!
在此链接中找到了更新的答案:
I have seen some odd behaviors occasionally. Here are some basic suggestions (some are dumb and you might have tried them already):
Try and re-use a fixed port so that there is no possibility of having multiple servers running.
Update: Found a new "classic" solution:
Delete the cache in IE and possibly Firefox too. Apparently the 'script' tag content tends to be cached by IE. If this works, we can all try tearing our hair out!
Found the updated answer at this link:
我过去也遇到过同样的问题,并且发现如果可用的 CPU 有限,则更有可能发生这种情况。例如,如果我的旧笔记本电脑使用电池运行,并且降低了 CPU 速度以节省电量,那么这种情况经常发生。当以最大性能模式在主电源上运行时,这种情况只会偶尔发生。现在我有了一台更新、功能更强大的笔记本电脑,问题就消失了。
我发现的另一个原因是 Eclipse 中设置了太多断点,删除断点通常可以解决问题。
I have had the same problem in the past and found it is much more likely to happen if limited CPU is available. For example if my older laptop was running on battery and had stepped down the CPU speed to save power it frequently happened. When running on mains in max performance mode it only happened occasionally. Now I have a much newer and more powerful laptop and the problem has gone away.
Another cause I found was too many breakpoints set up in eclipse and removing breakpoints would often clear the problem.
我遇到了浏览器缓存问题。
尝试清除浏览器缓存、加载失败后刷新几次等。
您还可以尝试使用不同的端口,以便 URL 不同。
下载并运行 GWT 应用程序需要一些时间,特别是如果您使用额外的库,因此请等待几秒钟以查看应用程序是否最终加载。
我还不知道是什么导致应用程序加载随机失败,但我怀疑,正如 Daniel Vaughan 所说,这与缺乏计算机资源、CPU、内存等有关。
I've had issues with the browser caching.
Try clearing your browser cache, refresh a few times after a failed load, etc.
You can also try using a different port so the URL is different.
It takes some time to download and run the GWT app, particularly if you are using extra libraries, so wait for a few seconds to see if the app finally loaded.
What makes the app loading to fail randomly is something I don't know yet, but I suspect, as stated by Daniel Vaughan, that is related with a lack of computer resources, CPU, memory, etc.