simple expression language error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

simple expression language error

Muhzin
Hi all ,

I am trying to define a predicate using simple expression language for my
router


.choice()
 .when().simple("${body.action} == 'updateLogin'")
 .bean(UpdateProfile.class, "editProfile")
.otherwise().bean(UpdateProfile.class, "noAction");


 Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin',
timeStamp='1390823126'}]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1360)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:93)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:74)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:85)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.processBatch(SqsConsumer.java:165)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.poll(SqsConsumer.java:84)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[85:org.apache.camel.camel-core:2.12.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by:
org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Binary
operator == does not support token & at location 18
${body.action} == 'updateLogin'
                  *

at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:69)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimpleLanguage.createPredicate(SimpleLanguage.java:115)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:91)[85:org.apache.camel.camel-core:2.12.1]
... 19 more
Caused by: org.apache.camel.language.simple.types.SimpleParserException:
Binary operator == does not support token &
at
org.apache.camel.language.simple.SimplePredicateParser.binaryOperator(SimplePredicateParser.java:600)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.doParsePredicate(SimplePredicateParser.java:83)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:66)[85:org.apache.camel.camel-core:2.12.1]
... 21 more
2014-01-27 18:03:34,840 | WARN  | rofile-data-sync | SqsConsumer
           | 158 - org.apache.camel.camel-aws - 2.12.1 | Exchange failed,
so rolling back message status: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin',
timeStamp='1390823126'}]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin',
timeStamp='1390823126'}]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1360)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:93)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:74)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:85)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.processBatch(SqsConsumer.java:165)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.poll(SqsConsumer.java:84)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[85:org.apache.camel.camel-core:2.12.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by:
org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Binary
operator == does not support token & at location 18
${body.action} == 'updateLogin'
                  *

at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:69)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimpleLanguage.createPredicate(SimpleLanguage.java:115)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:91)[85:org.apache.camel.camel-core:2.12.1]
... 19 more
Caused by: org.apache.camel.language.simple.types.SimpleParserException:
Binary operator == does not support token &
at
org.apache.camel.language.simple.SimplePredicateParser.binaryOperator(SimplePredicateParser.java:600)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.doParsePredicate(SimplePredicateParser.java:83)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:66)[85:org.apache.camel.camel-core:2.12.1]
... 21 more


Please advice.
--
BR
Muhsin
Reply | Threaded
Open this post in threaded view
|

RE: simple expression language error

Elvio Caruana (ecaruana)
Hi Muhsin,

From the exception cause: " SimpleIllegalSyntaxException: Binary operator == does not support token & at location 18 ${body.action} == 'updateLogin'"
It looks to me that somehow you've got a unicode encoding of the single quote (&#39). Replace it with a literal single quote (') and try again.

http://camel.apache.org/simple.html

Elvio


-----Original Message-----
From: Muhzin [mailto:[hidden email]]
Sent: 27 January 2014 12:57
To: [hidden email]
Subject: simple expression language error

Hi all ,

I am trying to define a predicate using simple expression language for my router


.choice()
 .when().simple("${body.action} == 'updateLogin'")  .bean(UpdateProfile.class, "editProfile") .otherwise().bean(UpdateProfile.class, "noAction");


 Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin', timeStamp='1390823126'}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1360)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:93)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:74)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:85)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.processBatch(SqsConsumer.java:165)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.poll(SqsConsumer.java:84)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[85:org.apache.camel.camel-core:2.12.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by:
org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Binary operator == does not support token & at location 18 ${body.action} == 'updateLogin'
                  *

at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:69)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimpleLanguage.createPredicate(SimpleLanguage.java:115)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:91)[85:org.apache.camel.camel-core:2.12.1]
... 19 more
Caused by: org.apache.camel.language.simple.types.SimpleParserException:
Binary operator == does not support token & at org.apache.camel.language.simple.SimplePredicateParser.binaryOperator(SimplePredicateParser.java:600)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.doParsePredicate(SimplePredicateParser.java:83)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:66)[85:org.apache.camel.camel-core:2.12.1]
... 21 more
2014-01-27 18:03:34,840 | WARN  | rofile-data-sync | SqsConsumer
           | 158 - org.apache.camel.camel-aws - 2.12.1 | Exchange failed, so rolling back message status: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin', timeStamp='1390823126'}]
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message:
Message{userId='52ce9198ddfa72.20156092', action='updateLogin', timeStamp='1390823126'}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1360)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:93)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:74)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:85)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.processBatch(SqsConsumer.java:165)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.component.aws.sqs.SqsConsumer.poll(SqsConsumer.java:84)[158:org.apache.camel.camel-aws:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[85:org.apache.camel.camel-core:2.12.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by:
org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: Binary operator == does not support token & at location 18 ${body.action} == 'updateLogin'
                  *

at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:69)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimpleLanguage.createPredicate(SimpleLanguage.java:115)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:91)[85:org.apache.camel.camel-core:2.12.1]
... 19 more
Caused by: org.apache.camel.language.simple.types.SimpleParserException:
Binary operator == does not support token & at org.apache.camel.language.simple.SimplePredicateParser.binaryOperator(SimplePredicateParser.java:600)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.doParsePredicate(SimplePredicateParser.java:83)[85:org.apache.camel.camel-core:2.12.1]
at
org.apache.camel.language.simple.SimplePredicateParser.parsePredicate(SimplePredicateParser.java:66)[85:org.apache.camel.camel-core:2.12.1]
... 21 more


Please advice.
--
BR
Muhsin