【问题标题】:Problems migrating to Spring boot 2 with CXF and Apache Camel使用 CXF 和 Apache Camel 迁移到 Spring boot 2 的问题
【发布时间】:2019-07-08 06:39:19
【问题描述】:

在我的项目中,我们使用的是 Spring Boot 1.5.7、Apache Camel 2.19.3 和 Apache CXF 3.2.1,并且我们对 SOAP 服务没有任何问题。但是当使用 Apache Camel 2.24.1 和 Apache CXF 3.3.2 迁移到 Spring Boot 2.1.3 时,SOAP 服务已经停止工作。

我希望在调用 SOAP 服务时,答案是正确的,就像迁移之前一样。但是,目前出现的错误如下。

[                          main] SpringCamelContext             INFO  Total 23 routes, of which 23 are started
[                          main] SpringCamelContext             INFO  Apache Camel 2.24.1 (CamelContext: mainContextCamel) started in 6.011 seconds
[                          main] InitApplication                INFO  Started InitApplication in 17.779 seconds (JVM running for 30.23)
[               qtp83182348-187] input                          INFO  Exchange[ExchangePattern: InOut, BodyType: null, Body: [Body is null]]
[               qtp83182348-182] PhaseInterceptorChain          WARN  Interceptor for {http://adaptation.ws.iacm.indra.com}adaptationService#{http://adaptation.ws.iacm.indra.com}getDefaultStep has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: null
    at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:107) ~[cxf-rt-frontend-jaxws-3.2.7.jar:3.2.7]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.3.2.jar:3.3.2]
    at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:90) [cxf-core-3.3.2.jar:3.3.2]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.3.2.jar:3.3.2]
    at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:278) [cxf-core-3.3.2.jar:3.3.2]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) [cxf-core-3.3.2.jar:3.3.2]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.3.2.jar:3.3.2]
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247) [cxf-rt-transports-http-jetty-3.3.2.jar:3.3.2]
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79) [cxf-rt-transports-http-jetty-3.3.2.jar:3.3.2]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:194) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.Server.handleAsync(Server.java:547) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:388) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:305) [jetty-server-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) [jetty-util-9.4.14.v20181114.jar:9.4.14.v20181114]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) [jetty-util-9.4.14.v20181114.jar:9.4.14.v20181114]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
Caused by: java.lang.NullPointerException
    at com.indra.iacm.adm.adp.jaxws_asm.GetDefaultStepResponse_WrapperTypeHelper1.createWrapperObject(Unknown Source) ~[?:?]
    at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:91) ~[cxf-rt-frontend-jaxws-3.2.7.jar:3.2.7]
    ... 22 more

【问题讨论】:

  • 尝试在您获得m.indra.iacm.adm.adp.jaxws_asm.GetDefaultStepResponse_WrapperTypeHelper1.createWrapperObject 中的 NPE 时查看您自己的源代码,例如通过调试或添加日志输出等
  • 当时我做的许多测试是调试你的代码。我发现 obs 归零。对象 o2 = helper.createWrapperObject(objs);
  • 调试 我看到了一个重要的区别。在从版本迁移之前,当我进行 SOAP 调用时,我首先通过我的服务,然后通过 WrapperClassOutInterceptor 拦截器。但是,在迁移 SOAP 调用后,它从未到达我的服务。并且拦截器给了我NPE,因为服务的响应是空的。

标签: spring-boot apache-camel cxf


【解决方案1】:

这个空指针错误似乎来自您的 cxf 服务的服务器端,因此您应该查看服务的后端。

【讨论】:

  • 问题是这个拦截器在调用我的服务之前就跳转了。这在迁移之前没有发生。
猜你喜欢
  • 1970-01-01
  • 2019-03-24
  • 2019-03-01
  • 1970-01-01
  • 2018-08-24
  • 1970-01-01
  • 1970-01-01
  • 2020-07-10
  • 1970-01-01
相关资源
最近更新 更多