Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Camel 3.10] jsonpath : Missing property in path $['room'] #2395

Closed
aldettinger opened this issue Mar 29, 2021 · 6 comments
Closed

[Camel 3.10] jsonpath : Missing property in path $['room'] #2395

aldettinger opened this issue Mar 29, 2021 · 6 comments
Assignees
Milestone

Comments

@aldettinger
Copy link
Contributor

Looks there is an issue starting with camel-quarkus 1.8.0, with a route like below:

        from("platform-http:/hello").
        choice().when().jsonpath("$.room[?(@.temperature > 20)]").
            setBody(simple("HOT")).
        otherwise().
            setBody(constant("WARM")).
        end();

when invoking with restassured:

given().body("{room:{temperature:30}}").when().post("/hello").then().statusCode(200);

It produces the stack trace below:

2021-03-29 10:41:24,828 WARN  [io.qua.arc.impl] (vert.x-worker-thread-0) 
================================================================================
CDI: programmatic lookup problem detected
-----------------------------------------
At least one bean matched the required type and qualifiers but was marked as unused and removed during build
Removed beans:
	- PRODUCER_METHOD bean io.quarkus.jackson.runtime.ObjectMapperProducer#objectMapper() [types=[interface com.fasterxml.jackson.core.Versioned, class com.fasterxml.jackson.core.TreeCodec, interface java.io.Serializable, class com.fasterxml.jackson.databind.ObjectMapper, class com.fasterxml.jackson.core.ObjectCodec], qualifiers=[@javax.enterprise.inject.Default(), @javax.enterprise.inject.Any()]]
Required type: class com.fasterxml.jackson.databind.ObjectMapper
Required qualifiers: []
Solutions:
	- Application developers can eliminate false positives via the @Unremovable annotation
	- Extensions can eliminate false positives via build items, e.g. using the UnremovableBeanBuildItem
	- See also https://quarkus.io/guides/cdi-reference#remove_unused_beans
================================================================================

2021-03-29 10:41:24,913 ERROR [org.apa.cam.pro.err.DefaultErrorHandler] (vert.x-worker-thread-0) Failed delivery for (MessageId: 032BD1354638674-0000000000000000 on ExchangeId: 032BD1354638674-0000000000000000). Exhausted after delivery attempt: 1 caught: org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']

Message History (complete message history is disabled)
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
[route1            ] [route1            ] [from[platform-http:///hello]                                                  ] [       172]
	...
[route1            ] [choice1           ] [choice[when[jsonpath{$.room[?(@.temperature > 20)]}],otherwise[setBody[constan] [         0]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
: org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:159)
	at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:35)
	at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:36)
	at org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.java:77)
	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:71)
	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:439)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:62)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:167)
	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:388)
	at org.apache.camel.component.platform.http.vertx.VertxPlatformHttpConsumer.lambda$handleRequest$2(VertxPlatformHttpConsumer.java:184)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:72)
	at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
	at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
	at org.apache.camel.jsonpath.JsonPathEngine.readWithAdapter(JsonPathEngine.java:258)
	at org.apache.camel.jsonpath.JsonPathEngine.doRead(JsonPathEngine.java:186)
	at org.apache.camel.jsonpath.JsonPathEngine.read(JsonPathEngine.java:106)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluateJsonPath(JsonPathExpression.java:190)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:144)
	... 15 more

2021-03-29 10:41:24,918 WARN  [org.apa.cam.com.pla.htt.ver.VertxPlatformHttpConsumer] (vert.x-eventloop-thread-9) Failed handling platform-http endpoint /hello. Caused by: [org.apache.camel.ExpressionEvaluationException - com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']]: org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:159)
	at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:35)
	at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:36)
	at org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.java:77)
	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:71)
	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:439)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:62)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:167)
	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:388)
	at org.apache.camel.component.platform.http.vertx.VertxPlatformHttpConsumer.lambda$handleRequest$2(VertxPlatformHttpConsumer.java:184)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:72)
	at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
	at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
	at org.apache.camel.jsonpath.JsonPathEngine.readWithAdapter(JsonPathEngine.java:258)
	at org.apache.camel.jsonpath.JsonPathEngine.doRead(JsonPathEngine.java:186)
	at org.apache.camel.jsonpath.JsonPathEngine.read(JsonPathEngine.java:106)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluateJsonPath(JsonPathExpression.java:190)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:144)
	... 15 more

2021-03-29 10:41:24,920 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-9) HTTP Request to /hello failed, error id: 4ad630d5-1ff3-40c8-98c5-afe67b4160cc-1: org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:159)
	at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:35)
	at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:36)
	at org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.java:77)
	at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:71)
	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:439)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:62)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:167)
	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:388)
	at org.apache.camel.component.platform.http.vertx.VertxPlatformHttpConsumer.lambda$handleRequest$2(VertxPlatformHttpConsumer.java:184)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room']
	at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:72)
	at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
	at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
	at org.apache.camel.jsonpath.JsonPathEngine.readWithAdapter(JsonPathEngine.java:258)
	at org.apache.camel.jsonpath.JsonPathEngine.doRead(JsonPathEngine.java:186)
	at org.apache.camel.jsonpath.JsonPathEngine.read(JsonPathEngine.java:106)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluateJsonPath(JsonPathExpression.java:190)
	at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:144)
	... 15 more

At first sight, it seems to occur when mixing platform-http and jsonpath, so maybe linked to how the JsonPathEngine resolve the body. Or maybe the ObjectMapper warning indicates that the engine mess up with jackson...

@aldettinger aldettinger changed the title jsonpath : HTTP Request to /hello failed, error id: 2f96a34e-881d-4c71-b807-cd256b4d8435-1: org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['room'] jsonpath : Missing property in path $['room'] Mar 29, 2021
@JiriOndrusek JiriOndrusek self-assigned this Apr 1, 2021
@JiriOndrusek
Copy link
Contributor

Problem is caused be an issue in Camel (https://issues.apache.org/jira/browse/CAMEL-16459). Which is now fixed by apache/camel#5299. This issue could be closed.

@ppalaga ppalaga changed the title jsonpath : Missing property in path $['room'] [Camel 3.10] jsonpath : Missing property in path $['room'] Apr 8, 2021
@aldettinger
Copy link
Contributor Author

ok, so it should flow from camel-master and I see the case is captured in camel tests now. I agree we can close. Well done @JiriOndrusek 👍

@ppalaga
Copy link
Contributor

ppalaga commented Apr 8, 2021

Let's close once we verify after upgrading to Camel 3.10.

@ppalaga ppalaga reopened this Apr 8, 2021
@aldettinger aldettinger added this to the 1.9.0 milestone Apr 8, 2021
@JiriOndrusek
Copy link
Contributor

@ppalaga my bad, I forgot that we have to wait to confirm fix in Camel 3.10

@ppalaga ppalaga modified the milestones: 1.9.0, 2.0.0 May 24, 2021
@aldettinger
Copy link
Contributor Author

This issue seems to be solved in camel-quarkus 2.0.0-M1. However, a similar one appeared #2676.

@ppalaga ppalaga modified the milestones: 2.0.0, 2.0.0-M1 May 26, 2021
@ppalaga
Copy link
Contributor

ppalaga commented May 26, 2021

Thanks for checking @aldettinger, let's close this one then.

@ppalaga ppalaga closed this as completed May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants