我的GWT RPC AsyncCallback不起作用:InvocationException [英] My GWT RPC AsyncCallback doesn’t work: InvocationException

查看:238
本文介绍了我的GWT RPC AsyncCallback不起作用:InvocationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个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
我的服务接口,异步接口和实现服务代码是与此示例相同
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服务器可能未在监听等等。
我的互联网运行良好。
任何建议?

非常感谢!
Helen

解决方案


  1. web.xml中定义的url模式中的前缀/ context_root 。在你的情况下,url模式将是/ comp / ChartGenerator。
  2. 在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 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. 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.

这篇关于我的GWT RPC AsyncCallback不起作用:InvocationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆