2015-04-06 75 views
0

我使用:GWT Designer不工作

的Eclipse 4.3開普勒JDK GWT與Eclipse 4.3(通過市場下載) GWT版本是通過市場與GWT默認2.6下載兼容。 0 Eclipse的Java編譯器的版本是1.7 這不是一個Maven項目

當我嘗試做打開GWT入口點類(這是一個UI),它拋出波紋管錯誤:

入口點類(默認創建b創建一個新的GWT項目)當y蝕:

package xsdf.com.client; 

import xsdf.com.shared.FieldVerifier; 

/** 
* Entry point classes define <code>onModuleLoad()</code>. 
*/ 
public class Xxwa implements EntryPoint { 
    /** 
    * The message displayed to the user when the server cannot be reached or 
    * returns an error. 
    */ 
    private static final String SERVER_ERROR = "An error occurred while " 
      + "attempting to contact the server. Please check your network " 
      + "connection and try again."; 

    /** 
    * Create a remote service proxy to talk to the server-side Greeting service. 
    */ 
    private final GreetingServiceAsync greetingService = GWT 
      .create(GreetingService.class); 

    /** 
    * This is the entry point method. 
    */ 
    public void onModuleLoad() { 
     final Button sendButton = new Button("Send"); 
     final TextBox nameField = new TextBox(); 
     nameField.setText("GWT User"); 
     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); 

     // Focus the cursor on the name field when the app loads 
     nameField.setFocus(true); 
     nameField.selectAll(); 

     // Create the popup dialog box 
     final DialogBox dialogBox = new DialogBox(); 
     dialogBox.setText("Remote Procedure Call"); 
     dialogBox.setAnimationEnabled(true); 
     final Button closeButton = new Button("Close"); 
     // We can set the id of a widget by accessing its Element 
     closeButton.getElement().setId("closeButton"); 
     final Label textToServerLabel = new Label(); 
     final HTML serverResponseLabel = new HTML(); 
     VerticalPanel dialogVPanel = new VerticalPanel(); 
     dialogVPanel.addStyleName("dialogVPanel"); 
     dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); 
     dialogVPanel.add(textToServerLabel); 
     dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); 
     dialogVPanel.add(serverResponseLabel); 
     dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); 
     dialogVPanel.add(closeButton); 
     dialogBox.setWidget(dialogVPanel); 

     // Add a handler to close the DialogBox 
     closeButton.addClickHandler(new ClickHandler() { 
      public void onClick(ClickEvent event) { 
       dialogBox.hide(); 
       sendButton.setEnabled(true); 
       sendButton.setFocus(true); 
      } 
     }); 

     // Create a handler for the sendButton and nameField 
     class MyHandler implements ClickHandler, KeyUpHandler { 
      /** 
      * Fired when the user clicks on the sendButton. 
      */ 
      public void onClick(ClickEvent event) { 
       sendNameToServer(); 
      } 

      /** 
      * Fired when the user types in the nameField. 
      */ 
      public void onKeyUp(KeyUpEvent event) { 
       if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { 
        sendNameToServer(); 
       } 
      } 

      /** 
      * Send the name from the nameField to the server and wait for a response. 
      */ 
      private void sendNameToServer() { 
       // First, we validate the input. 
       errorLabel.setText(""); 
       String textToServer = nameField.getText(); 
       if (!FieldVerifier.isValidName(textToServer)) { 
        errorLabel.setText("Please enter at least four characters"); 
        return; 
       } 

       // Then, we send the input to the server. 
       sendButton.setEnabled(false); 
       textToServerLabel.setText(textToServer); 
       serverResponseLabel.setText(""); 
       greetingService.greetServer(textToServer, 
         new AsyncCallback<String>() { 
          public void onFailure(Throwable caught) { 
           // Show the RPC error message to the user 
           dialogBox 
             .setText("Remote Procedure Call - Failure"); 
           serverResponseLabel 
             .addStyleName("serverResponseLabelError"); 
           serverResponseLabel.setHTML(SERVER_ERROR); 
           dialogBox.center(); 
           closeButton.setFocus(true); 
          } 

          public void onSuccess(String result) { 
           dialogBox.setText("Remote Procedure Call"); 
           serverResponseLabel 
             .removeStyleName("serverResponseLabelError"); 
           serverResponseLabel.setHTML(result); 
           dialogBox.center(); 
           closeButton.setFocus(true); 
          } 
         }); 
      } 
     } 

     // Add a handler to send the name to the server 
     MyHandler handler = new MyHandler(); 
     sendButton.addClickHandler(handler); 
     nameField.addKeyUpHandler(handler); 
    } 
} 

,當我嘗試打開與GWT Designer中的上述類錯誤:

Internal Error 
encountered unexpected internal error. 

This could be caused by a bug or by a misconfiguration issue, conflict, partial update, etc. 

java.lang.NoSuchMethodError: com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Z)Lcom/google/gwt/dev/cfg/ModuleDef; 



Show stack trace. 
Hide stack trace. 

Stack trace: 
java.lang.NoSuchMethodError: com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Z)Lcom/google/gwt/dev/cfg/ModuleDef; 
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.loadModule(HostedModeSupportImpl.java:85) 
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.createModuleSpaceHost(HostedModeSupportImpl.java:64) 
    at sun.reflect.NativeMetho 

我已經檢查可能出現的問題:

如果我使用GWT設計器遇到NoSuchMethodError或NoClassDefFoundError,該怎麼辦?

https://developers.google.com/web-toolkit/tools/gwtdesigner/faq#NoSuchMethodError

我已經嘗試過不同的虛擬機,1.8,1.6;

GWT設計師是否仍然是ative?設計用戶界面是更好的選擇嗎? 如何糾正此錯誤並使GWT設計器正常工作?

+0

您可能想要將GWT版本更新爲2.6.1。這是基於此[鏈接]的錯誤(https://code.google.com/p/google-web-toolkit/issues/detail?id=8649) – 2015-04-06 06:14:48

回答

2

GWT Designer沒有維護。它不適用於GWT 2.6.0或2.7,並可能不適用於較新的版本。它可以與2.6.1協同工作,但我不建議使用除最新版本以外的任何其他版本,特別是「經典」DevMode也不推薦使用:2.7是SuperDevMode真正可用的第一個版本,它將繼續在未來版本中有所改進。

+0

就是這樣! GWT設計師將不會更加修飾?爲什麼?非常好的項目... – felipe 2015-04-07 21:54:24