[ 
https://issues.apache.org/activemq/browse/CAMEL-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56151#action_56151
 ] 

Gert Vanthienen commented on CAMEL-1567:
----------------------------------------

I managed to reproduce the binary incompatibility issue that Hadrian mentioned 
earlier -- it looks like juel by default ships with a slightly different set of 
javax.el classes:
{noformat}
java.lang.NoSuchMethodError: 
javax.el.ExpressionFactory.newInstance(Ljava/util/Properties;)Ljavax/el/ExpressionFactory;
        at 
org.apache.camel.language.juel.JuelExpression.getExpressionFactory(JuelExpression.java:66)
        at 
org.apache.camel.language.juel.JuelExpression.setVariable(JuelExpression.java:105)
        at 
org.apache.camel.language.juel.JuelExpression.populateContext(JuelExpression.java:88)
        at 
org.apache.camel.language.juel.JuelExpression.evaluate(JuelExpression.java:57)
{noformat}

The way to avoid running into this issue is by using the JUEL 
ExpressionFactoryImpl class directly (cfr. 
http://svn.apache.org/viewvc?view=revision&revision=885153)

> Upgrading to JUEL 2.1.1 - Beware of API changes in JUEL
> -------------------------------------------------------
>
>                 Key: CAMEL-1567
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1567
>             Project: Apache Camel
>          Issue Type: Task
>          Components: camel-juel
>    Affects Versions: 1.6.0, 2.0-M1
>            Reporter: Claus Ibsen
>            Assignee: Hadrian Zbarcea
>             Fix For: 2.1.0
>
>
> Hi Claus,
> Here is an explanation of the API change from Christopher Beck at JUEL:
> Hello Yogesh,
> the API to resolve methods has changed in 2.1.1. Camel's method resolver
> is breaks with JUEL 2.1.1. Generally, methods are still resolved via
> ELResolver.getValue(context, base, property), but
> - in 2.1.0, the method name was passed as a property
> - in 2.1.1, an instance of de.odysseus.el.misc.MethodInvocation is passed
> as a property
> The reason for this is to provide more detailed information about the
> method invocation to the resolver (i.e the method name, number of arguments
> and whether vararg calls are supported).
> Now, camel-juel uses its BeanAndMethodELResolver to resolve methods.
> There, findMethod(context, base, property) only handles a property
> parameter of type string. That's why it doesn't work. When migrating to
> juel 2.1.1, the BeanAndMethodELResolver class needs to be updated to work
> with MethodInvocation objects as properties.
> The JUEL 2.1.1 distribution contains a sample resolver. Taking the sample
> code, updating camel's resolver should be pretty straightforward. When
> doing so, you may also want to add property "javax.el.varArgs" in
> JuelExpression.populateDefaultExpressionProperties(..). That way you would
> take real profit by invoking vararg methods from within EL expressions.
> There's also a way to quickly modify your resolver to work with both, JUEL
> 2.1.0 and 2.1.1. Just don't ask for "property instanceof String" but use
> property.toString() as a candidate method name: the MethodInvocation's
> toString() will answer the method name.
> See nabble:
> http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-td23177119s22882.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to