GWT:RPC失败(StatusCodeException)

GWT:RPC失败(StatusCodeException),gwt,rpc,Gwt,Rpc,在我的项目中,实现了一个RPC接口,用于在GWT和服务器之间进行通信,如下所述: 所有现有方法都可以很好地调用,但最近我引入了一个新方法,当调用它时会导致RPC失败: com.google.gwt.user.client.rpc.StatusCodeException: The call failed on the server; see server log for details at com.google.gwt.user.client.rpc.impl.RequestCallb

在我的项目中,实现了一个RPC接口,用于在GWT和服务器之间进行通信,如下所述:

所有现有方法都可以很好地调用,但最近我引入了一个新方法,当调用它时会导致RPC失败:

com.google.gwt.user.client.rpc.StatusCodeException: The call failed on the server; see server log for details
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:192)
    at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:254)
    at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:226)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:217)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.moz.MethodDispatch.invoke(MethodDispatch.java:80)
    at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
    at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1428)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840)
    at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
    at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
    at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
(在托管模式下运行时显示此Exception stacktrace)

以下是我所做的更改:

  • 我使用新方法扩展了我的服务接口:

    @RemoteServiceRelativePath(“myservice”) 公共接口MyService扩展了RemoteService{ // ... 布尔值isSomethingValid(字符串参数检查); }

  • 我实现了我的方法:

    公共类PMyServiceImpl扩展了GWTSpringController实现了MyService{ //

    public Boolean isSomethingValid(String paramToCheck) {
      // do something ...
    }
    
    }

  • 我将方法定义添加到异步接口:

    公共接口MyServiceAsync{ // ... void isSomethingValid(字符串paramToCheck,AsyncCallback); }

  • 就这样。我遗漏了什么吗?有没有提示RPC失败的原因?在我的服务器日志中,我可以看到以下异常:

    [7/26/11 11:48:16:618 CEST] 0000004a WebApp        A   SRVE0181I: [myapplication.war] [/istoolset] [Servlet.LOG]: Exception while dispatching incoming RPC call: com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.Boolean com.ubs.istoolset.front.fet.gwt.businessmodel.client.service.MyService.isSomethingValid(java.lang.String)' threw an unexpected exception: java.lang.NullPointerException
            at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
            at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
            at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
            at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
            at com.ubs.istoolset.gwt.framework.rpc.GWTSpringController.handleRequest(GWTSpringController.java:48)
            at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:859)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
            at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:593)
            at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:534)
            at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
            at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
            at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
            at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:450)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:508)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:296)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:270)
            at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
            at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
            at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
            at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
            at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
            at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
    Caused by: java.lang.NullPointerException
            at com.ubs.istoolset.front.fet.gwt.businessmodel.server.MyServiceImpl.isSomethingValid(MyServiceImpl.java:1906)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:618)
            at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
            ... 27 more
    

    非常感谢您的帮助,谢谢

    我不熟悉com.ubs命名空间(这是您的代码吗?),但堆栈跟踪(服务器端)中的NullPointerException是一个问题:

    Caused by: java.lang.NullPointerException
            at     com.ubs.istoolset.front.fet.gwt.businessmodel.server.MyServiceImpl.isSomethingValid(MyServiceImpl.java:1906)
    
    那里发生了什么事