1 Reply Latest reply on May 7, 2009 12:05 AM by Claus Ibsen

    XPath Exception Using Camel 1.5.4 within Fuse ESB 3.4

    Gary Motts Novice

      Hi,

       

      I'm trying to use an Camel XPath fitler to read a message out of an ActiveMQ topic queue and place it into an ActiveMQ queue. I've validated the XPath using external tools, but I continue to receive XPath exceptions whenever the XML message is routed to my topic endpoint.

       

      Here's the Camel expressions within MyRouteBuilder that I'm using:

       

      public class MyRouteBuilder extends RouteBuilder {

       

      public void configure() {

       

      from("jbi:service:http://ventyx.com/core/myRouteBuilder")

      .choice()

      .when()

      .xpath("//SOICanonicalHeader")

      .to("activemq:topic:topic2")

      .otherwise()

      .to("activemq:queue:InvalidMessageQueue");

       

       

      from("activemq:topic:topic2").filter().xpath("/InboundRequest/SOICanonicalHeader").

      to("activemq:queue:example1");

       

      }

       

      Here's the Exception:

       

      WARN - EndpointMessageListener - Endpoint[activemq:topic:topic2|http://fusesource.com/forums/] consumer caught an exception while processing JMS message: ActiveMQMessage {commandId = 5, responseRequired = true, messageId = ID:GMOTTS0705072-3676-1241626061718-2:48:1:1:1, originalDestination =

      null, originalTransactionId = null, producerId = ID:GMOTTS0705072-3676-1241626061718-2:48:1:1, destination = topic://topic2, transactionId = null, expiration = 0, timestamp = 1241634317468, arrival = 0, brokerInTime = 1241634317468, brokerOutTime = 1241634317484, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = mailto:org.apache.activemq.util.ByteSequence@1e3885c, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {org_apache_servicemix_file_name=work order2.xml, org_apache_servicemix_file_path=C:\ESB\iona\fuse-esb-3.4.0.1\temp\publisher2\work order2.xml}, readOnlyProperties = true, readOnlyBody = true, droppable = false}

      org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: /InboundRequest/SOICanonicalHeader. Reason: javax.xml.xpath.XPathExpressionException at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:443)

      at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:98)

      at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:63)

      at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:38)

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

      at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:185)

      at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:132)

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

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

      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)

      at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)

      at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:72)

      at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)

      at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)

      at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)

      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)

      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)

      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)

      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:881)

      at java.lang.Thread.run(Thread.java:619)

      Caused by: javax.xml.xpath.XPathExpressionException

      at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:193)

      at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:429)

      ... 19 more

       

      Any help is appreciated,

       

      Thanks,

       

      Gary

       

      Edited by: gmotts on May 6, 2009 3:06 PM

       

      Edited by: gmotts on May 6, 2009 3:08 PM

        • 1. Re: XPath Exception Using Camel 1.5.4 within Fuse ESB 3.4
          Claus Ibsen Master

          Hi

           

          Yeah Xpath can be troublesome to work with.

           

          Its this route that causes an exception:

          rom("activemq:topic:topic2").filter().xpath("/InboundRequest/SOICanonicalHeader").

          to("activemq:queue:example1");

           

          I guess its your xpath expression here that is invalid:

          xpath("/InboundRequest/SOICanonicalHeader")

           

          As its reported in the stacktrace:

          rg.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath: /InboundRequest/SOICanonicalHeader. Reason: javax.xml.xpath.XPathExpressionException

          at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:443)

           

           

          Maybe it should be like the other xpath you have:

          .xpath("//SOICanonicalHeader")