NullPointerException in CXF producer endpoint used in Camel route.

Solution Verified - Updated -

Issue

We define a Camel route that consumes from a CXF endpoint, transforms the message and then sends the message to another external Web Service using a CXF producer endpoint. E.g.

<cxf:cxfEndpoint id="consumer" address="myRouteService/" serviceClass="...">
  <cxf:properties>
    <entry key="dataFormat" value="MESSAGE" />
  </cxf:properties>
</cxf:cxfEndpoint>

<cxf:cxfEndpoint id="producer" address="http://localhost:9000/myservice" serviceClass="...">
  <cxf:properties>
    <entry key="dataFormat" value="PAYLOAD" />
  </cxf:properties>
</cxf:cxfEndpoint>

<camelContext xmlns="http://camel.apache.org/schema/blueprint" trace="true">
  <route id="test" trace="true" streamCache="true">
      <from uri="cxf:bean:consumer"/>
      ...
      <camel:to uri="cxf:bean:producer"/>
</camelContext>

At runtime messages get routed successfully but we also see this NullPointerException in the log

java.lang.NullPointerException
  at org.apache.camel.component.cxf.DefaultCxfBinding.getResponsePayloadList(DefaultCxfBinding.java:434)[org.apache.camel:camel-cxf:2.15.1.redhat-621103]
  at org.apache.camel.component.cxf.DefaultCxfBinding.populateCxfResponseFromExchange(DefaultCxfBinding.java:350)[org.apache.camel:camel-cxf:2.15.1.redhat-621103]
  at org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:216)[org.apache.camel:camel-cxf:2.15.1.redhat-621103]
  at org.apache.camel.component.cxf.CxfConsumer$1.syncInvoke(CxfConsumer.java:143)[org.apache.camel:camel-cxf:2.15.1.redhat-621103]
  at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:78)[org.apache.camel:camel-cxf:2.15.1.redhat-621103]
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66]
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[org.apache.cxf:cxf-core:3.0.4.redhat-621084]
  at org.apache.cxf.transport.jms.JMSDestination.onMessage(JMSDestination.java:233)[org.apache.cxf:cxf-rt-transports-jms:3.0.4.redhat-621084]
  at org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$XAPoller.run(PollingMessageListenerContainer.java:117)[org.apache.cxf:cxf-rt-transports-jms:3.0.4.redhat-621084]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
  at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]

Environment

  • JBoss Fuse 6.2.1
  • Apache Camel 2.15.1
  • Apache CXF 3.0.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content