My GWT RPC AsyncCallback doesn’t work: InvocationE

2019-08-19 03:21发布

I developed a GWT application and make a AsyncCallback a jfreechart generated in server side. But there is an error returning a InvocationException. The detailed error message is here 404 html com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209) callback.onResponseReceived(this, response);

I used GWT 2.5.1 and jre7 and eclipse juno 4.2 My Service Interface, Asynchronous Interface and Implementing Service codes are the same as this example http://www.jfree.org/phpBB2/viewtopic.php?t=19080&sid=f627bee2b70f0f512009d737957b8eee

I have added servlet in my web.xml

<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>

I checked the documentation of RPC and it said InvocationException can happen for many reasons: the network may be disconnected, a DNS server might not be available, the HTTP server might not be listening, and so on. My internet is working well. Any suggestion?
Many thanks! Helen

1条回答
一纸荒年 Trace。
2楼-- · 2019-08-19 03:59
  1. Prefix "/context_root" in url pattern defined in web.xml. In your case the url pattern will be "/comp/ChartGenerator".
  2. Use annotation @RemoteServiceRelativePath("ChartGenerator") in RemoteService interface.
查看更多
登录 后发表回答