gnodet wrote: > > You should be able to do that by setting a FunctionResolver on the > xpath expression: > > <eip:xpath-predicate xpath="filter:check(string(/header/value))" > namespaceContext="#nsContext"> > <eip:functionResolver> > <bean class="org.apache.xalan.extensions.XPathFunctionResolverImpl" > /> > </eip:functionResolver> > </eip:xpath-predicate> > > Then you should be able to use xalan java extensions as advertised at > http://xml.apache.org/xalan-j/extensions.html. > Though I have never tried ... > Please report back any success or issue. > >
Unfortunately the NPE is still there. The ExtensionsProvider cannot be retrieved from the XPathContext. The call getOwnerObject() in FuncExtFunction returns null. Did I overlook something? On 12/13/06, frankr <[EMAIL PROTECTED]> wrote: > > Is it possible to use a Java method extension function as EIP filter XPath > predicate? > > I'm trying to implement the EIP filter pattern using a Java extension > function. The function does a check and either returns true or false based > on which the message is filtered out. > > On arrival of messages I get the following NPE: > > > javax.jbi.messaging.MessagingException: > javax.xml.xpath.XPathExpressionException: > javax.xml.transform.TransformerException: Unknown error in XPath. > at > org.apache.servicemix.expression.JAXPXPathExpression.evaluate(JAXPXPathExpression.java:104) > at > org.apache.servicemix.eip.support.XPathPredicate.matches(XPathPredicate.java:49) > at > org.apache.servicemix.eip.patterns.MessageFilter.processAsync(MessageFilter.java:185) > at > org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java:241) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:410) > at > org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:43) > at > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624) > at > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:169) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227) > at > org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291) > at > EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748) > at java.lang.Thread.run(Thread.java:595) > Caused by: javax.xml.xpath.XPathExpressionException: > javax.xml.transform.TransformerException: Unknown error in XPath. > at > org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:191) > at > org.apache.servicemix.expression.JAXPBooleanXPathExpression.evaluateXPath(JAXPBooleanXPathExpression.java:37) > at > org.apache.servicemix.expression.JAXPXPathExpression.evaluate(JAXPXPathExpression.java:97) > ... 12 more > Caused by: javax.xml.transform.TransformerException: Unknown error in > XPath. > at org.apache.xpath.XPath.execute(XPath.java:363) > at org.apache.xpath.XPath.execute(XPath.java:301) > at > org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123) > at > org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97) > at > org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178) > ... 14 more > Caused by: java.lang.NullPointerException > at > org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:206) > at org.apache.xpath.XPath.execute(XPath.java:335) > ... 18 more > > > My filter is configured as follows: > > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns:eip="http://servicemix.apache.org/eip/1.0" > xmlns:ci="http://test/test"> > > <eip:message-filter > service="ci:core-inbound-double-message-filter" > endpoint="endpoint"> > <eip:target> > <eip:exchange-target > > service="ci:core-inbound-enhancer-pipeline" /> > </eip:target> > <eip:filter> > <eip:xpath-predicate > > xpath="filter:check(string(/header/value))" > namespaceContext="#nsContext" /> > </eip:filter> > </eip:message-filter> > > <eip:namespace-context id="nsContext"> > <eip:namespaces> > <eip:namespace > prefix="filter">java:test.DoubleMessageFilter</eip:namespace> > </eip:namespaces> > </eip:namespace-context> > > </beans> > > The DoubleMessageFilter class is available on the classpath and has a > static > check method which returns a boolean value. > > Is it possible what I'm trying to achieve or do I need a different > approach? > Input appreciated. > show [EMAIL PROTECTED] as [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Java-method-extension-function-as-EIP-filter-predicate-tf2815187s12049.html#a7867420 Sent from the ServiceMix - User mailing list archive at Nabble.com.
