One Star

EL predicate in Camel route fails /only/ when being deployed in Karaf

Hi,
the following route works perfectly well when being executed in a JSE
environment, e.g., using camel:run. But when it is being deployed in
Karaf, the evaluation of the EL predicate fails with the exception
pasted below the route.
The project was created with the camel-archetype-spring-dm.
If someone knows what is going
on any help would be appreciated.
Regards
Jerry
The route:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlnsSmiley Surprisedsgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"
>
<route>
<from
uri="file:/home/jerry/Documents/projects/20111017_Australia/mqu.workspace/exploration.juel/src/test/resources?noop=true"/>
<to uri="log:exp.test?level=DEBUG&showBody=false"/>
<filter>
<!-- <simple>in.body</simple> -->
<el>${(in.body != null) && (in.body.isAbsolute())}</el>
<to uri="log:exp.ok?level=DEBUG"/>
</filter>
<to uri="log:exp.done?level=DEBUG&showBody=false"/>
</route>
</camelContext>
</beans>

The result when running it in Karaf:
karaf@tesb> log:display-exception
de.odysseus.el.tree.TreeBuilderException: Error parsing '${(in.body !=
null) && (in.body.isAbsolute())}': syntax error at position 42,
encountered '(', expected ')'
at
de.odysseus.el.tree.impl.Builder.build(Builder.java:100)
at
de.odysseus.el.tree.TreeStore.get(TreeStore.java:61)
at
de.odysseus.el.TreeValueExpression.<init>(TreeValueExpression.java:69)
at
de.odysseus.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:302)
at
de.odysseus.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:81)
at
org.apache.camel.language.juel.JuelExpression.evaluate(JuelExpression.java:72)
at
org.apache.camel.impl.ExpressionSupport.matches(ExpressionSupport.java:32)
at
org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:46)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:273)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:137)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:86)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2 REPLIES
One Star

Re: EL predicate in Camel route fails /only/ when being deployed in Karaf

One thing that I found out in the meantime is that there somehow are two jar files in the classpath that provide the juel library:
/home/jerry/.m2/repository/de/odysseus/juel/juel/2.1.2/juel-2.1.2.jar
/home/jerry/.m2/repository/org/apache/servicemix/bundles/org.apache.servicemix.bundles.juel/2.1.2_1/org.apache.servicemix.bundles.juel-2.1.2_1.jar
Additionally there is a jar that adds the javax.el package that is provided by the other jars as well:
/home/jerry/.m2/repository/org/apache/geronimo/specs/geronimo-el_1.0_spec/1.0.1/geronimo-el_1.0_spec-1.0.1.jar
Both are added as a Maven dependency - I'll attach the pom.
Can anyone shed any light on this?
Regards
Jerry
Employee

Re: EL predicate in Camel route fails /only/ when being deployed in Karaf

Jerry, yeah I am seeing the same thing. The odysseus parser doesn't seem to like the method call on the body: in.isAbsolute(). Two things to try (I will look at it again in the morning). One if there is a workaround, like just using the attribute, but I doubt it'll work. The second, which we need to do anyway, is to fix the dependency problem.
Btw, what is the type of your body? I can use any pojo that has methods, but just so I try something close to the original.