【发布时间】:2014-03-21 18:04:49
【问题描述】:
我开发了一个 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 服务器可能没有监听,等等。
我的互联网运行良好。
有什么建议吗?
非常感谢!
海伦
【问题讨论】:
-
您的 RPC 实现是否在您的
web.xml文件中注册为 servlet? -
是的,我已经在web.xml中添加了它们
-
... 而你的 RPC 接口包含
@RemoteServiceRelativePath("comp/ChartGenerator")注释? (注意:根据您的 Web 服务器配置,您可能需要改用@RemoteServiceRelativePath("../comp/ChartGenerator")。) -
谢谢吉尔伯托。我没有在我的 RPC 接口中使用 @RemoteServiceRelativePath("comp/ChartGenerator") 。刚才我添加了这个相对路径并再次测试我的应用程序,错误仍然是一样的。有什么建议吗?
-
我已经尝试了@RemoteServiceRelativePath("../comp/ChartGenerator") 和@RemoteServiceRelativePath("comp/ChartGenerator") 两个版本。调用者中的相同错误消息。如何检查我的 Web 服务器配置?我在开发模式下测试我的应用程序。所以它是 127.0.0.1:8888/comp/chartGenerator 。看起来正常吗?非常感谢!
标签: java gwt rpc asynccallback