问题描述
我开发了一个GWT应用程序,并在服务器端生成一个jfreechart的AsyncCallback。但是返回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
我的服务接口,异步接口和实现服务代码是与此示例相同
我在我的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服务器可能未在监听等等。
我的互联网运行良好。
任何建议?
非常感谢!
Helen
- web.xml中定义的url模式中的前缀/ context_root 。在你的情况下,url模式将是/ comp / ChartGenerator。
- 在RemoteService接口中使用注释@RemoteServiceRelativePath(ChartGenerator)。
>
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 here404 htmlcom.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.2My Service Interface, Asynchronous Interface and Implementing Service codes are the same as this examplehttp://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 saidInvocationException 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
- Prefix "/context_root" in url pattern defined in web.xml. In your case the url pattern will be "/comp/ChartGenerator".
- Use annotation @RemoteServiceRelativePath("ChartGenerator") in RemoteService interface.
这篇关于我的GWT RPC AsyncCallback不起作用:InvocationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!