4 Replies Latest reply on Jun 13, 2011 9:42 PM by daynok

    camel cxf producer to cxf-nmr consumer  java.lang.NullPointerException

    daynok

      I've been trying to get two separate bundles to communicate via a nmr endpoint using a camel cxf producer.  I have been working on this all week and so far I can't get it to work.

       

      I can however all the nmr endpoint just as in example cxf-camel-nmr without issue so I know that bundle is ok.  Seriously this is a super simple hello world prototype and I can't get it to work. 

       

      Any help or suggestions would be awesome!!

       

      Env: Java 1.5

      Apache Servicemix 4.3.2

       

      In servicemix I have two separate osgi bundles.    I am unable to get my camel cxf producer to successfully call the nmr endpoint and have zero clue on how to fix.

       

       

      Bundle #1 cxf-nmr //consumer

       

       

      ####################

      Console Output - No Idea How To Fix

      ####################

       

      18:56:04,544 | ERROR | oWorld1-thread-1 | NMRDestination                   |  -  -  | error preparing message

      java.lang.NullPointerException

           at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]

           at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]

      18:56:04,547 | WARN  | oWorld1-thread-1 | NMR                              | 83 - org.apache.servicemix.nmr.core - 1.4.0 | Error processing exchange [

        id:        a778d16c-2955-41de-89e8-7775f4f976bf

        mep:       InOut

        status:    Active

        role:      Provider

        target:    PropertyMatchingReference[{NAME=HelloWorld1}]

        properties: [

            jaxwsContext = {javax.xml.ws.wsdl.operation={http://cxf.examples.servicemix.apache.org/}sayHi, javax.xml.ws.wsdl.description=http://localhost:9090/test?wsdl, javax.xml.ws.wsdl.service=HelloWorldService, javax.xml.ws.wsdl.interface=HelloWorld, javax.xml.ws.wsdl.port=HelloWorldPort}

            CamelToEndpoint = nmr://HelloWorld1

            org.apache.cxf.service.model.BindingOperationInfo = BindingOperationInfo: {http://cxf.examples.servicemix.apache.org/}sayHi

            mtom-enabled = false

            CamelCreatedTimestamp = Thu Jun 09 18:56:04 PDT 2011

            CamelCXFDataFormat = PAYLOAD

        ]

      ]

       

      org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]

           at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]

      Caused by: java.lang.NullPointerException

           at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           ... 6 more

      18:56:04,552 | ERROR | f2d4607-thread-1 | DefaultErrorHandler              | 68 - org.apache.camel.camel-core - 2.6.0 | Failed delivery for exchangeId: ID-Dana-PC-45880-1307670949817-0-2. Exhausted after delivery attempt: 1 caught: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException

      org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]

           at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]

      Caused by: java.lang.NullPointerException

           at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           ... 6 more

      18:56:04,553 | WARN  | qtp407691725-242 | PhaseInterceptorChain            |  -  -  | Interceptor for HelloWorldService#sayHi has thrown exception, unwinding now

      org.apache.cxf.interceptor.Fault: java.lang.NullPointerException

           at org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:219)[118:org.apache.camel.camel-cxf:2.6.0]

           at org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:196)[118:org.apache.camel.camel-cxf:2.6.0]

           at org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:116)[118:org.apache.camel.camel-cxf:2.6.0]

           at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:73)[118:org.apache.camel.camel-cxf:2.6.0]

           at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:224)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:70)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:311)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:280)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[116:org.apache.cxf.bundle:2.3.2]

           at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:931)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:868)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.Server.handleAsync(Server.java:397)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:601)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:410)[149:org.eclipse.jetty.server:7.2.2.v20101205]

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)[144:org.eclipse.jetty.io:7.2.2.v20101205]

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)[144:org.eclipse.jetty.io:7.2.2.v20101205]

           at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[144:org.eclipse.jetty.io:7.2.2.v20101205]

           at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)[143:org.eclipse.jetty.util:7.2.2.v20101205]

           at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]

      Caused by: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]

           at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]

           ... 1 more

      Caused by: java.lang.NullPointerException

           at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]

           at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]

           ... 6 more

        • 1. Re: camel cxf producer to cxf-nmr consumer  java.lang.NullPointerException
          ffang

          Hi,

           

          Try adding  in your camel router.

           

          Freeman

          • 2. Re: camel cxf producer to cxf-nmr consumer  java.lang.NullPointerException
            daynok

            Thanks for the reply Freeman but am still running into errors.

             

            Any idea's?

             

            ####

            Request

            #####

            ]]

                 at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143)[68:org.apache.camel.camel-core:2.6.0]

                 at org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:93)[75:org.apache.camel.camel-spring:2.6.0]

                 at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)[68:org.apache.camel.camel-core:2.6.0]

                 ... 51 more

            10:52:43,410 | WARN  | qtp270227447-209 | PhaseInterceptorChain            |  -  -  | Interceptor for HelloWorldService#sayHi has thrown exception, unwinding now

            org.apache.cxf.interceptor.Fault: No body available of type: javax.xml.transform.stream.StreamSource but has value: org.apache.camel.component.cxf.CxfPayload headers: []body: [ []]

                 at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143)[68:org.apache.camel.camel-core:2.6.0]

                 at org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:93)[75:org.apache.camel.camel-spring:2.6.0]

                 at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)[68:org.apache.camel.camel-core:2.6.0]

                 ... 51 more

            10:52:43,414 | WARN  | qtp270227447-209 | PhaseInterceptorChain            |  -  -  | Interceptor for HelloWorldService#sayHi has thrown exception, unwinding now

            org.apache.cxf.interceptor.Fault: No body available of type: javax.xml.transform.stream.StreamSource but has value: org.apache.camel.component.cxf.CxfPayload headers: []body: [ []]

                 at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143)[68:org.apache.camel.camel-core:2.6.0]

                 at org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:93)[75:org.apache.camel.camel-spring:2.6.0]

                 at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)[68:org.apache.camel.camel-core:2.6.0]

                 ... 51 more

            • 3. Re: camel cxf producer to cxf-nmr consumer  java.lang.NullPointerException
              njiang

              Hi,

              Please take a look at this exception. Camel that you used can't turn a CxfPayload message into StreamSource.

              org.apache.camel.InvalidPayloadException: No body available of type: javax.xml.transform.stream.StreamSource but has value: org.apache.camel.component.cxf.CxfPayload headers: []body: [ [<m:sayHi xmlns:m="http://cxf.examples.servicemix.apache.org/">
              <arg0>foobar</arg0>
              </m:sayHi>]] 
              

              I think you can just use the MESSAGE instead of PAYLOAD data formate to pass the message to the nmr endpoint.

               

              Willem

              • 4. Re: camel cxf producer to cxf-nmr consumer  java.lang.NullPointerException
                daynok

                Thanks for the hint Willem,

                Yea I thought for some reason that it had to be payload, message did the trick.  Whohoo got hello world up and running lols