IncompatibleRemoteServiceException:此应用程序已过期,请单击浏览器上的刷新按钮

我的GWT项目工作正常,但今天,经过一些更改并添加新的一个异步调用后,没有执行。 例外情况是“此应用程序已过期,请单击浏览器上的刷新按钮。” 执行所有其他异步调用。

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. ( Blocked attempt to access interface 'com.client.FInterface', which is not implemented by 'com.server.FServiceImpl'; this is either misconfiguration or a hack attempt ) at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:252) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) 

客户:

  public void onClick(ClickEvent event) { fService.getRepositories(repocallback); } }); 

接口

  @RemoteServiceRelativePath("init") public interface FInterface extends RemoteService{ FCollection getRepositories(); } 

AsyncInterface

  public interface FInterfaceAsync { void getRepositories(AsyncCallback repositoryCallback); } 

服务

  public class FService implements FInterfaceAsync { FInterfaceAsync service =(FInterfaceAsync)GWT.create(FInterface.class); ServiceDefTarget endpoint = (ServiceDefTarget) service; public FService(){ endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "init"); } } 

服务器

  public class FServiceImpl extends RemoteServiceServlet implements FInterface { public FilnetFolderCollection getRepositories() { } } 

XML:

   FServlet com.server.FServiceImpl   FServlet /FServiceImpl  

有人帮我解决了这个问题。

如果在浏览器中运行的Javascript代码与在服务器上部署的Javascript不同,则会引发此错误。 在这种情况下,浏览器中的JavaScript代码通过Async调用服务器上的方法,并且该方法的参数或参数类型的数量已在服务器上更改,此方法不存在,因为GWT服务器端无法找到具有该方法的方法参数或类型的数量,因为服务器上的方法更新。 如果浏览器仍然具有缓存的GWT Javascript,并且当您启动浏览器时它不会从服务器加载新的JavaScript文件,而是从缓存中获取本地文件,则会发生这种情况。 通过强制浏览器使用Ctrl-F5刷新浏览器中的本地缓存版本将会消失,因为将检索服务器中的新版本并且应该修复此问题。 在生产中,如果未将webserver或java服务器的缓存设置设置为使nocache文件无效,则可能导致此问题。 另请参阅http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#perfect_caching

可以通过以下方式解决错误:

  1. 清除浏览器缓存
  2. 清除Web服务器缓存
  3. 清除类文件并重建项目。 您可以通过运行“清理”和“安装”阶段的maven或IntellijIdea的“Build – > Rebuild Project”菜单和Eclipse中的“Project – > Clean”菜单来重建项目。

在代码中进行服务器端更改后,您需要重新启动项目或重新加载Web服务器..它将解决问题