java - GWT:重新加载 Web 服务器不工作

标签 java eclipse gwt

我只是在运行在 Eclipse 中创建的默认问候语应用程序。

public void onModuleLoad() {
    final Button sendButton = new Button("Send");
    final TextBox nameField = new TextBox();
    nameField.setText("GWT Userrrr");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // ...
}

如果我改变一些东西,例如注释掉按钮的 add(),网站不会反射(reflect)这些更改。即使我在开发模态视图中单击“重新加载 Web 服务器”按钮也不行。如果我这样做,我只会得到:

May 31, 2015 6:30:22 PM com.google.appengine.tools.development.AbstractModule shutdown
INFO: Shutting down module instance default
May 31, 2015 6:30:22 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
May 31, 2015 6:30:23 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@0.0.0.0:8888
May 31, 2015 6:30:23 PM com.google.appengine.tools.development.AbstractModule startup
INFO: Module instance default is running at http://localhost:8888/
May 31, 2015 6:30:23 PM com.google.appengine.tools.development.AbstractModule startup
INFO: The admin console is running at http://localhost:8888/_ah/admin
   Reload completed successfully

但未应用更改。

唯一有帮助的是重新编译整个 GWT 项目,不幸的是,这需要很长时间,因此这不是我想要的方式。

我怎样才能让它工作?

最佳答案

server 包中的.java 文件需要编译成.class 才能被服务器解释。

这是由 GWT 编译器完成的,它遗憾地将所有其他客户端类编译为 javascript。

为了加快开发速度,您可以通过在 xxx.gwt.xml 文件中指定目标浏览器来减少编译器所做的排列数

<set-property name="user.agent" value="safari" />

从技术上讲,也可以在服务器端类上使用 java 编译器来编译它们。

引用 http://www.gwtproject.org/doc/latest/DevGuideDeploying.html

Class files

The build script generated by the webAppCreator utility automatically takes care of compiling your servlet classes and placing them in the war/WEB-INF/classes folder. However, it is possible that your resources may fall out of sync as you make changes to your server-side code that don’t necessarily incur changes in your GWT client-side code, and hence you may forget to run the compiler to generate the new .class files for your servlet classes. In such cases, you could run the build script over your application code once more to generate the new .class files, but a simple javac would also suffice and probably take less time to compile. If the RPC service method signatures have changed, however, then you will need to re-compile your application with the GWT compiler.

关于java - GWT:重新加载 Web 服务器不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30559527/

相关文章:

java - 我想在 android 中以编程方式下载文件,但是运行时它关闭了?

java - 在 Tomcat 远程部署上只上传源代码

java - 如何使简单的 RCP 应用程序真正独立?

GWT:无法第二次实例化基于 uiBinder 的小部件

java - GWT 在 RPC 调用中反序列化泛型列表

java - 实现前获取JPanel的大小

java - "org.hibernate.DuplicateMappingException"错误是什么意思?

java - 复制后 Amazon S3 Java SDK copyObject 权限被拒绝

java - 在调试期间重新组织列表顺序

java - 运行 GWT 时出现空白(白色)页错误