2011-05-26 7 views
5

我的GWT應用程序有問題。我部署在Jetty服務器上並運行。但是,當我執行服務器調用(GWT服務器包上的類)時,服務器返回錯誤消息。該消息是:com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException

7|0|6|http://localhost/zbapp/zb_app/|A31E1254E17F9AD731856D6BE34124A2|main.java.com.gwt.app.client.GreetingService|greetServer|java.lang.String/2004016611||1|2|3|4|2|5|5|6|6| 
//EX[2,1,["com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","This application is out of date, please click the refresh button on your browser. (Expecting version 5 from client, got 7.)"],0,5] 

但是,服務器返回一個200代碼即可。

我已更新瀏覽器,清除瀏覽器緩存並重新編譯應用程序,但它不運行。有什麼解決方案?

在此先感謝!

問候!

回答

9

您的客戶端是最新的,因爲它使用GWT-RPC協議版本7發送請求,但服務器期望版本5.檢查您是否部署了正確版本的gwt-servlet.jar,和/或您在您的服務器類路徑中沒有使用舊版本,而是使用您的Web應用程序中的舊版本。

更具體地說,當GWT 2.1或更高版本(協議版本7)編譯客戶端代碼時,您的GWT中的gwt-servlet.jar介於1.5和2.0之間(GWT-RPC協議的第5版) 。

+0

我得到這個錯誤太。首先,你如何找出哪個版本的RPC版本在你的客戶端和服務器端兼容,以及如何改變它? – EternallyCurious 2013-05-02 08:31:27

+0

很簡單:您必須在兩側都使用完全相同的GWT版本;和完全相同版本的應用程序(雖然有解決方法,但它是關於序列化策略的) – 2013-05-02 08:35:22

+0

那麼,我在Eclipse上安裝了GWT插件並從頭開始開發此項目。作爲單一安裝,我沒有理由相信客戶機和服務器應該不兼容。但是,我收到了上述問題中顯示的相同消息。我在eclipse中使用dev模式運行它並使用chrome進行調試。 – EternallyCurious 2013-05-02 08:41:18

0

我改變了庫,錯誤消失了。但是,錯誤更改。現在我的錯誤是:

//EX[2,1,["com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","Could not locate requested interface 'main.java.com.gwt.app.client.GreetingService' in default classloader"],0,7] 

但接口是在classloader中。

然後,需要從HttpServlet的重寫方法 '服務':

@Override 
protected void service(HttpServletRequest req, HttpServletResponse resp) 
     throws ServletException, IOException { 
    // Cache the current thread 
    Thread currentThread = Thread.currentThread(); 
    // We are going to swap the class loader 
    ClassLoader oldContextClassLoader = 
    currentThread.getContextClassLoader(); 
    currentThread.setContextClassLoader(this.getClass().getClassLoader()); 
    super.service(req, resp); 
    currentThread.setContextClassLoader(oldContextClassLoader); 
} 

因此,應用程序上運行春分!!

1

問題解決了(在恐怕我的版本的話)

ERROR: 拋出異常處理此呼叫:未知方法 - >異常:com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException 消息:此應用程序已過時,請點擊瀏覽器上的刷新按鈕。 (期待從客戶端版本5,得到7)。

解決方案: 尋找哪個依賴拉動gwt用戶模塊(jar),因爲這是問題的可能原因。首先確認您的lib文件夾刪除 GWT用戶罐子解決問題,那麼你也可以修改你的Maven使用的'GWT-用戶一個排除如下:

<dependency> 
    <groupId>com.google.gwt.google-apis</groupId> 
    <artifactId>gwt-visualization</artifactId> 
    <version>1.0.2</version> 
    <exclusions> 
     <exclusion> 
      <groupId>com.google.gwt</groupId> 
      <artifactId>gwt-user</artifactId> 
     </exclusion> 
     </exclusions> 
</dependency> 
相關問題