【问题标题】:GWT : getting InvocationTargetException while making a server callGWT:在进行服务器调用时获取 InvocationTargetException
【发布时间】:2013-10-03 14:31:21
【问题描述】:

在提交登录表单时,一旦我发现用户是有效的,我就会进行异步调用,我想将他重定向到提供 html 内容的 servlet。 在尝试这样做时,我面临 InvocationTargetException。 以下是代码sn -p

@Override
public Boolean validateUser(String emailId, String password){

//validate the user

if(valid){

HttpServletResponseWrapper wrapper =injector.getInstance(HttpServletResponseWrapper.class);

wrapper.setResponse(response);

wrapper.sendRedirect("/render?viewPage=" + PageNameConstant.LANDINGPAGE);
}                   
}

在 RenderServlet 中

ServletOutputStream servletOutputStream = servletResponse.getOutputStream();

 servletOutputStream.write(pgContent.getBytes());

 **servletOutputStream.close();**

当我尝试关闭 servletOutputStream 时出现异常。

我应该如何进行上述操作?

【问题讨论】:

  • 您应该提供所有详细信息,例如您如何发出请求、应该使用什么 servlet 或处理程序来处理它以及错误日志。
  • @SotiriosDelimanolis 我已经为我的实现添加了一些代码 sn-ps 任何帮助表示赞赏:)

标签: java gwt servlets gwt-rpc


【解决方案1】:

那不是Target invocation exception 这是InvocationTargetException

request 不完整是因为

1)If it is live server,Client network disconnected . 

2)Or if you are compiled your `impl` classes using java 1.7. 

切换回 java 6 并尝试。 GWT 目前不支持 java 7。

我怀疑你是用 1.7 编译的。没有?

【讨论】:

  • @Suresh Atta 我正在使用 jdk_1.6 进行编译,目前我正在托管模式下测试实现..
猜你喜欢
  • 2013-03-20
  • 1970-01-01
  • 2012-08-21
  • 1970-01-01
  • 2012-04-19
  • 1970-01-01
  • 2021-08-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多