进行 REST 调用时抛出 CXF 异常

发布于 2024-12-04 00:54:46 字数 5482 浏览 0 评论 0原文

我有一个带有 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();
.......

I have a REST Service with a CXF & Spring backend and ExtJS front end.

The GET methods for the service work perfectly. I have attempted to implement a POST service with a new DAO and implementation at the end backend.

I have verified that the parameters are being passed in successfully to the service but when it makes a call to the backend method, it returns a strange exception that I can't trace back.

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

I've ran it in debug mode and know that it fails on the method call - the service is implemented as:

 @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();
.......

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小…楫夜泊 2024-12-11 00:54:46

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

@Consumes(MediaType.APPLICATION_FORM_URLENCODED)

到您的方法中?

Just a suggestion, have you tried adding

@Consumes(MediaType.APPLICATION_FORM_URLENCODED)

to your method?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文