GWT(和GQuery)中的表单提交事件导致IncompatibleRemoteServiceException

时间:2013-05-04 05:42:58

标签: gwt gwtquery

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 caught)。这是例外:

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)

1 个答案:

答案 0 :(得分:0)

最可能的原因是jars version.

检查gwt-servlet.ja r是否为uptodate。 gwt-user.jargwt-servlet.jar必须具有相同的版本。

在此处查看A discussion