我的GWT RPC AsyncCallback不起作用:InvocationException

时间:2014-02-20 16:30:51

标签: java gwt rpc asynccallback

我开发了一个GWT应用程序,并使AsyncCallback成为服务器端生成的jfreechart。但是返回InvocationException时出错。 详细的错误消息在这里 404 html com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209) callback.onResponseReceived(this,response);

我使用GWT 2.5.1和jre7以及eclipse juno 4.2 我的服务接口,异步接口和实现服务代码与此示例相同 http://www.jfree.org/phpBB2/viewtopic.php?t=19080&sid=f627bee2b70f0f512009d737957b8eee

我在web.xml中添加了servlet

<servlet>
<servlet-name>ChartGenerator</servlet-name>
<servlet-class>com.test.server.ChartGeneratorImpl</servlet-class>
</servlet>

<servlet>
    <servlet-name>DisplayChart</servlet-name>
    <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>ChartGenerator</servlet-name>
    <url-pattern>/comp/ChartGenerator</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>DisplayChart</servlet-name>
    <url-pattern>/comp/DisplayChart</url-pattern>
</servlet-mapping>

我检查了RPC的文档,它说 InvocationException可能由于多种原因而发生:网络可能断开连接,DNS服务器可能不可用,HTTP服务器可能没有监听,等等。 我的网络运行良好。 有什么建议吗? 非常感谢! 海伦

1 个答案:

答案 0 :(得分:0)

  1. 在web.xml中定义的url模式中的前缀“/ context_root”。在您的情况下,网址模式将是“/ comp / ChartGenerator”。
  2. 在RemoteService界面中使用注释@RemoteServiceRelativePath(“ChartGenerator”)。