调用REST调用时抛出CXF异常

时间:2011-09-12 09:02:56

标签: java spring rest cxf

我有一个带有CXF&的REST服务Spring后端和ExtJS前端。

服务的GET方法完美无缺。我尝试使用新的DAO实现POST服务,并在最后端实现。

我已经验证参数是成功传递给服务的,但是当它调用后端方法时,它会返回一个我无法追溯的奇怪异常。

09:57:41.004 [http-8081-Processor21] WARN  o.a.cxf.phase.PhaseInterceptorChain - Application has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: null
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:148) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:114) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:118) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:78) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) [cxf-2.2.3.jar:2.2.3]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_25]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_25]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_25]
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:452) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:159) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:220) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:153) [cxf-2.2.3.jar:2.2.3]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) [servlet-api.jar:na]
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.service(AbstractCXFServlet.java:211) [cxf-2.2.3.jar:2.2.3]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) [catalina.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) [catalina.jar:na]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) [catalina.jar:na]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) [catalina.jar:na]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:na]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) [catalina.jar:na]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) [catalina.jar:na]
    at ria.eclipsetomcatsso.siteminder.SiteMinderValve.forwardAuthSucceededResponse(SiteMinderValve.java:207) [ria_eclipsetomcatsso.jar:5.5.0]
    at ria.eclipsetomcatsso.siteminder.SiteMinderValve.invoke(SiteMinderValve.java:140) [ria_eclipsetomcatsso.jar:5.5.0]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) [catalina.jar:na]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879) [tomcat-http.jar:na]
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) [tomcat-http.jar:na]
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) [tomcat-util.jar:5.1]
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) [tomcat-util.jar:5.1]
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) [tomcat-util.jar:5.1]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]
Caused by: java.lang.NullPointerException: null
    at itlnc.detr_web.restful.server.impl.DisplayServiceImpl.updateStatus(DisplayServiceImpl.java:96) [DisplayServiceImpl.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_25]
    at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_25]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:166) [cxf-2.2.3.jar:2.2.3]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82) [cxf-2.2.3.jar:2.2.3]
    ... 33 common frames omitted

我已经在调试模式下运行它并且知道它在方法调用上失败 - 该服务实现为:

 @Override
    @POST
    @Produces("application/json")
    @Path("/updatestatus")
    public boolean updateReportStatus(@FormParam("reportDate") String reportDt, @FormParam("status") String status) {
        System.err.println("report date = "+reportDt);
        System.err.println("status = "+status);
        System.err.println("In service to update");
        gridUpdateDao.updateStatus();
.......

1 个答案:

答案 0 :(得分:0)

只是一个建议,您是否尝试过添加

@Consumes(MediaType.APPLICATION_FORM_URLENCODED)

你的方法?