0 Replies Latest reply on Jul 30, 2010 3:37 AM by andrea tarocchi

    testing xslt camel endpoint

    andrea tarocchi Newbie

      If I deploy this camel route:

           <camelContext xmlns="http://camel.apache.org/schema/spring">
           <route>
                <from uri="timer://myTimer?fixedRate=true&amp;period=5000"></from>
                <setBody>
                     <simple>&lt;person firstName='Anderson' lastName='Nielson' /&gt;</simple>
                </setBody>
                <to uri="xslt:attributeToElementValue.xsl"></to>
                <bean ref="authorization" method="log"></bean>
           </route>
           </camelContext>
      

      in a bundle in FUSE-ESB 4.2.0 it works fine.

      If I test it with camel-test (so without deploying it in FUSE) it throws this exception:

      SEVERE: Failed delivery for exchangeId: 254a6175-86e3-4a3e-917f-8d61d287d4b8. Exhausted after delivery attempt: 1 caught: org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson' />
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      Jul 30, 2010 9:20:23 AM org.apache.camel.processor.Logger log
      SEVERE: Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [org.apache.camel.ExpectedBodyTypeException - Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>]
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      Jul 30, 2010 9:20:28 AM org.apache.camel.processor.Logger log
      SEVERE: Failed delivery for exchangeId: 6f834d18-9eef-4c6e-a120-8c1ed58fa84e. Exhausted after delivery attempt: 1 caught: org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      Jul 30, 2010 9:20:28 AM org.apache.camel.processor.Logger log
      SEVERE: Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [org.apache.camel.ExpectedBodyTypeException - Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>]
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      Jul 30, 2010 9:20:33 AM org.apache.camel.processor.Logger log
      SEVERE: Failed delivery for exchangeId: 3c35bec0-afbc-4457-841d-b0185aded8aa. Exhausted after delivery attempt: 1 caught: org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      Jul 30, 2010 9:20:33 AM org.apache.camel.processor.Logger log
      SEVERE: Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [org.apache.camel.ExpectedBodyTypeException - Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>]
      org.apache.camel.ExpectedBodyTypeException: Could not extract IN message body as type: interface javax.xml.transform.Source body is: <person firstName='Anderson' lastName='Nielson'></person>
           at org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:291)
           at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:79)
           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:106)
           at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:103)
           at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:189)
           at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:103)
           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:87)
           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:97)
           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
           at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
           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:75)
           at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
           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.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
           at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
      

       

      This problem is present only with xslt or xpath endpoint, others endpoints works in testing environment also.

      valdar@calliope:~$ java -version
      java version "1.6.0_20"
      Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
      

      pom file attached.