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-quarkus-couchbase Consumer is not working #3283

Closed
oscerd opened this issue Nov 10, 2021 · 15 comments
Closed

Camel-quarkus-couchbase Consumer is not working #3283

oscerd opened this issue Nov 10, 2021 · 15 comments

Comments

@oscerd
Copy link
Contributor

oscerd commented Nov 10, 2021

Suppose to run

docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase:6.5.1

and to create sample bucket "beer-sample" with the sample data by creating a user admin/password

Now run a simple route

import javax.enterprise.context.ApplicationScoped;

import org.apache.camel.builder.RouteBuilder;

@ApplicationScoped
public class CamelRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("couchbase://http://localhost:8091?bucket=beer-sample&username=admin&password=password")
                .to("log:info");
    }
}

This will fail badly with

2021-11-10 12:08:34,679 WARN  [org.apa.cam.com.cou.CouchbaseConsumer] (Camel (quarkus-camel-example-http-log) thread #0 - couchbase://http://localhost:8091) Consumer Consumer[couchbase://http://localhost:8091?bucket=beer-sample&password=xxxxxx&username=admin] failed polling endpoint: couchbase://http://localhost:8091?bucket=beer-sample&password=xxxxxx&username=admin. Will try again at next poll. Caused by: [com.couchbase.client.core.error.DecodingFailureException - Deserialization of content into target class com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode failed; encoded = ["21st_amendment_brewery_cafe"]]: com.couchbase.client.core.error.DecodingFailureException: Deserialization of content into target class com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode failed; encoded = ["21st_amendment_brewery_cafe"]
	at com.couchbase.client.java.codec.JacksonJsonSerializer.deserialize(JacksonJsonSerializer.java:137)
	at com.couchbase.client.java.view.ViewRow.lambda$decode$0(ViewRow.java:126)
	at java.base/java.util.Optional.map(Optional.java:265)
	at com.couchbase.client.java.view.ViewRow.decode(ViewRow.java:122)
	at com.couchbase.client.java.view.ViewRow.keyAs(ViewRow.java:77)
	at org.apache.camel.component.couchbase.CouchbaseConsumer.poll(CouchbaseConsumer.java:121)
	at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:190)
	at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:107)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (byte[])"["21st_amendment_brewery_cafe"]"; line: 1, column: 1]
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
	at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1764)
	at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1209)
	at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:274)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4593)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3609)
	at com.couchbase.client.java.codec.JacksonJsonSerializer.deserialize(JacksonJsonSerializer.java:134)
@oscerd
Copy link
Contributor Author

oscerd commented Nov 10, 2021

This works fine on Camel-plain

@jamesnetherton
Copy link
Contributor

This works fine on Camel-plain

I adapted the Camel csimple example with the route mentioned above and observed the same issue. Whenever Jackson is added to the classpath, it triggers the error.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 11, 2021

I'll try again the kamelets using Jackson just for confirmation.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 11, 2021

Thanks for checking

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

This works fine on Camel-plain

I adapted the Camel csimple example with the route mentioned above and observed the same issue. Whenever Jackson is added to the classpath, it triggers the error.

ah ok, now I'm getting your message. If you run this https://github.com/apache/camel-examples/tree/main/examples/couchbase-log

The error we are seeing on camel-quarkus is not showing up and the route is the same. This is true with 3.13.0-SNAPSHOT and 3.11.1/3.11.2

So I'm not sure this is a problem on plain camel

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

Btw with csimple adapted I don't have errors

07:54:52.954 [org.apache.camel.example.MyApplication.main()] INFO  o.apache.camel.main.BaseMainSupport - Auto-configuration summary
07:54:52.957 [org.apache.camel.example.MyApplication.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.name=MyCSimpleCamel
07:54:52.957 [org.apache.camel.example.MyApplication.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.beanIntrospectionExtendedStatistics=true
07:54:52.957 [org.apache.camel.example.MyApplication.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.beanIntrospectionLoggingLevel=INFO
07:54:52.958 [org.apache.camel.example.MyApplication.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.lightweight=true
07:54:53.053 [org.apache.camel.example.MyApplication.main()] INFO  o.a.c.l.csimple.CSimpleLanguage - Loaded and initialized 1 csimple expressions from classpath
07:54:53.203 [org.apache.camel.example.MyApplication.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Routes startup summary (total:1 started:1)
07:54:53.203 [org.apache.camel.example.MyApplication.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Started route1 (timer://foo)
07:54:53.204 [org.apache.camel.example.MyApplication.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Apache Camel 3.13.0-SNAPSHOT (MyCSimpleCamel) started in 206ms (build:12ms init:88ms start:106ms)
07:54:53.205 [org.apache.camel.example.MyApplication.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Lightweight mode enabled. Performing optimizations and memory reduction.
07:54:54.258 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:54:55.204 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:54:56.204 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:54:57.204 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 16
07:54:58.204 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:54:59.205 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:00.206 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:55:01.207 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 3
07:55:02.208 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:55:03.208 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:04.208 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:05.208 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:55:06.209 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:55:07.209 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:08.210 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:09.210 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:55:10.210 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:55:11.210 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:55:12.211 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 11
07:55:13.211 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:55:14.211 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:55:15.212 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:55:16.212 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:55:17.212 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:55:18.212 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:19.213 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:20.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:55:21.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:55:22.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:23.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:24.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 2
07:55:25.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 7
07:55:26.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:55:27.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:55:28.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:55:29.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:30.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:55:31.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 11
07:55:32.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:55:33.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:34.214 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 10
07:55:35.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:55:36.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:37.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:55:38.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 10
07:55:39.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:55:40.215 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 7
07:55:41.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 11
07:55:42.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:43.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:55:44.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:55:45.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 11
07:55:46.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:55:47.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:55:48.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:49.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:55:50.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:55:51.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:55:52.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 16
07:55:53.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:55:54.216 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:55.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:55:56.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:55:57.217 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:55:58.218 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:55:59.218 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 16
07:56:00.218 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:56:01.218 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:56:02.218 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:03.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:56:04.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:05.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 3
07:56:06.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:07.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:56:08.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:56:09.219 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:56:10.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 17
07:56:11.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 19
07:56:12.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:56:13.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:56:14.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:56:15.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 7
07:56:16.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:56:17.220 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:56:18.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 16
07:56:19.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 4
07:56:20.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:56:21.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 15
07:56:22.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:56:23.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:56:24.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:56:25.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 3
07:56:26.221 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:56:27.222 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 2
07:56:28.222 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:29.222 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 3
07:56:30.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:56:31.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:56:32.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 5
07:56:33.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 3
07:56:34.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:35.223 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:56:36.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 2
07:56:37.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 12
07:56:38.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:39.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 16
07:56:40.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:56:41.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:56:42.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 9
07:56:43.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:56:44.224 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 6
07:56:45.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 0
07:56:46.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:56:47.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13
07:56:48.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 8
07:56:49.225 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 7
07:56:50.226 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 11
07:56:51.226 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 18
07:56:52.226 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 1
07:56:53.226 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 14
07:56:54.226 [Camel (MyCSimpleCamel) thread #1 - timer://foo] INFO  route1 - low 13

and the route is

package org.apache.camel.example;

import org.apache.camel.builder.RouteBuilder;

public class MyRouteBuilder extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("timer:foo?period={{myPeriod}}")
            .transform().csimple("${random(20)}")
            .marshal().json()
            .log("low ${body}");
    }
}

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

cc @davsclaus

@jamesnetherton
Copy link
Contributor

Sorry - maybe I confused things here a bit. I only chose csimple because it was easy to hack and add couchbase. I didn't see the couchbase-log example.....

The underlying issue is with adding Jackson libs to the classpath (E.g via camel-jackson). If you do that on CQ or plain Camel, it makes the application fail. Without it, things run ok.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

In csimple example I added the camel-jackson dep and It didn't fail for me.

@jamesnetherton
Copy link
Contributor

In csimple example I added the camel-jackson dep and It didn't fail for me.

Add camel-jackson to the couchbase-log example and watch it fail.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

Oh, silly me. I was under the impression you were using the csimple example as is. Sorry for that.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

Let me see what is happening

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

In 3.1.4 couchbase client is using jackson-databind 2.12.2 and in 3.2.0 2.12.3, while Camel 3.13.x is using 2.12.4 and Camel 3.11.x is using 2.12.3.

It's weird.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

Excluding jackson-databind from camel-jackson, make it works.

Ok they're shading databind.

@oscerd
Copy link
Contributor Author

oscerd commented Nov 12, 2021

Thanks @jamesnetherton

Definitely not a problem of camel or camel-quarkus.

@oscerd oscerd closed this as completed Nov 12, 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

2 participants