0

GWT 和 GQuery 中的表单提交事件导致 IncompatibleRemoteServiceException。该项目包括用于调用表单提交的 GQuery(JQuery 的 GWT 版本)。这是它的代码。该事件被插入到 onmoduleload 函数中:

$("#search_form").submit(new Function(){
    public void f() {
    QueryRequest query = new QueryRequest();
    String keywords = $("#keyword_search_box").val();
    query.setKeywords(keywords);
    greetingService.search(query, new AsyncCallback<QueryResponse>() {

            @Override
            public void onFailure(Throwable caught) {
                Window.alert(COUNLDNT_REACH_SERVER);
        }

        @Override
        public void onSuccess(QueryResponse result) {
            $("#page").add(renderResponse(result));
        }
    });
    }
});

每当单击提交按钮时,就会出现异常。如果服务器调用是从提交事件之外进行的,它可以正常工作 - 否则执行 public void onFailure(Throwable catch)。这是一个例外:

Starting Jetty on port 8888
   [WARN] greetServlet: An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Could not locate requested method 'greetServer(com.project.shared.QueryRequest)' in interface 'com.project.client.GreetingService' )
    at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:310)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
4

1 回答 1

0

最可能的原因是jars version.

检查gwt-servlet.jar 是否是最新的。gwt-user.jargwt-servlet.jar必须具有相同的版本。

请参阅此处的讨论。

于 2013-05-04T06:38:01.310 回答