6 Replies Latest reply on Sep 10, 2010 9:55 PM by Willem Jiang

    Problem using XPATH with camel

    Robert Kozura Newbie

      Hello all!  I am having problems using xpath.  Here is my camel route:

       

       

       

       

       

       

      I am getting the following error in the log file:

       

      09:24:16,247 | WARN  | 9@qtp-32833315-1 | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  365 | Interceptor for RouterService#invoke has thrown exception, unwinding now

      org.apache.cxf.interceptor.Fault: org.apache.cxf.message.MessageContentsList

        • 1. Re: Problem using XPATH with camel
          Claus Ibsen Master

          Use google to find hits about that exception.

           

          And maybe try adding  in the route to convert to String so the data can be read multiple times. I bet CXF may use streams.

           

          You can also enable stream caching

          http://camel.apache.org/stream-caching

          • 2. Re: Problem using XPATH with camel
            Willem Jiang Master

            Ah, org.apache.cxf.message.MessageContentsList.

            You are using the POJO dataformat of camel-cxf endpoint, please try to use Message dataformat and cache the inputstream.

            • 3. Re: Problem using XPATH with camel
              Robert Kozura Newbie

              Thank you for the help!  I enabled streamCaching on my route.  My cxf endpoint is already in message mode:

               

              @WebServiceProvider()

              @ServiceMode(Mode.MESSAGE)

              public class Router implements Provider, however the beans are not processed.

               

              Here is a general bean I have:

               

              public SOAPMessage processSOAP(Exchange exchange) {

                       System.out.println("Got here."); //I GET HERE!

                      ...

              }

              • 4. Re: Problem using XPATH with camel
                Willem Jiang Master

                Did your bean processSOAP method print "Got here" ?

                Can you show us the stack trace?

                 

                You are using the WebServiceProvider, so you can get the SOAPMessage from the exchange.getInMessage().getBody(SOAPMessage.class).

                But if convert the message body into String, you can't use the upper code anymore.

                 

                 

                Willem

                • 5. Re: Problem using XPATH with camel
                  Robert Kozura Newbie

                  Sure:

                   

                  org.apache.cxf.interceptor.Fault

                       at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:101)

                       at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

                       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)

                       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)

                       at java.util.concurrent.FutureTask.run(FutureTask.java:123)

                       at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

                       at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)

                       at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)

                       at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)

                       at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)

                       at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:327)

                       at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:151)

                       at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)

                       at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)

                       at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)

                       at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)

                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)

                       at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)

                       at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

                       at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

                       at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)

                       at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

                       at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

                       at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)

                       at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)

                       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

                       at org.mortbay.jetty.Server.handle(Server.java:326)

                       at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

                       at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)

                       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)

                       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

                       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

                       at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

                       at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

                  Caused by: java.lang.NullPointerException

                       at org.apache.servicemix.examples.demo_soap.MyTransform.processSOAP(MyTransform.java:40)

                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                       at java.lang.reflect.Method.invoke(Method.java:592)

                       at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:214)

                       at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:133)

                       at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:137)

                       at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:95)

                       at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:65)

                       at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)

                       at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)

                       at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)

                       at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)

                       at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)

                       at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)

                       at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)

                       at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)

                       at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)

                       at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)

                       at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)

                       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)

                       at org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)

                       at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)

                       at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)

                       at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)

                       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

                       at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)

                       at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)

                       at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)

                       at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)

                       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

                       at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)

                       at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)

                       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)

                       at org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)

                       at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)

                       at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)

                       at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)

                       at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)

                       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

                       at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:91)

                       ... 33 more

                   

                   

                  I do indeed get the message: "Got here"

                   

                  There are two options I can think of to fix this:

                   

                  1.  Convert the body back to the original format.  I have tried this and it does not work.

                   

                  2.  Have the bean method accept a String and try and build a response from that.

                  • 6. Re: Problem using XPATH with camel
                    Willem Jiang Master

                    It's a NPE from the MyTransoform.java.

                    Caused by: java.lang.NullPointerException
                    at org.apache.servicemix.examples.demo_soap.MyTransform.processSOAP(MyTransform.java:40)
                    

                     

                    I need to have a look at it.

                     

                    Willem