You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Grzegorz Grzybek (Jira)" <ji...@apache.org> on 2022/10/11 15:05:00 UTC

[jira] [Commented] (CAMEL-18603) Camel-Jbang: When using aws-ddb-sink Kamelet dependency are not resolved

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

Grzegorz Grzybek commented on CAMEL-18603:
------------------------------------------

The problem is that there are two classloaders involved:
* one is the app classloader containing JARs being part of {{-classpath}} prepared by JBang itself - this involves all transitive dependencies of the {{DEPS}} specified in {{dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java}}
* the other one is {{org.apache.camel.main.download.DependencyDownloaderClassLoader}} prepared for the camel context created for {{jbang camel run}} command.

camel-kamelet-utils was not seeing the amazonsdk jars, because of two different classloaders.

When I removed {{org.apache.camel.kamelets:camel-kamelets-utils}} from {{main.CamelJBang}} and added it to the route itself:
```yaml
# camel-k: dependency=mvn:software.amazon.awssdk:dynamodb:2.17.290
# camel-k: dependency=mvn:org.apache.camel.kamelets:camel-kamelets-utils:0.9.0
- route:
    from:
      uri: "kamelet:kafka-not-secured-source"
...
```

everything worked fine.

> Camel-Jbang: When using aws-ddb-sink Kamelet dependency are not resolved
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-18603
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18603
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>    Affects Versions: 3.19.0
>            Reporter: Andrea Cosentino
>            Priority: Major
>             Fix For: 3.20.0
>
>         Attachments: BeansConfiguration-1.class, BeansConfiguration.class, BeansConfiguration.kt, CamelConfiguration-1.class, CamelConfiguration.class, CamelConfiguration.kt, ComponentsConfiguration-1.class, ComponentsConfiguration.class, ComponentsConfiguration.kt, DataFormatsConfiguration-1.class, DataFormatsConfiguration.class, DataFormatsConfiguration.kt, KotlinCompilationConfiguration$1$1-1.class, KotlinCompilationConfiguration$1$1.class, KotlinCompilationConfiguration$1$2-1.class, KotlinCompilationConfiguration$1$2.class, KotlinCompilationConfiguration$1-1.class, KotlinCompilationConfiguration$1.class, KotlinCompilationConfiguration-1.class, KotlinCompilationConfiguration.class, KotlinCompilationConfiguration.kt, KotlinConstants.kt, KotlinConstantsKt-1.class, KotlinConstantsKt.class, KotlinDSL-1.class, KotlinDSL.class, KotlinDSL.kt, KotlinRoutesBuilderLoader$WhenMappings-1.class, KotlinRoutesBuilderLoader$WhenMappings.class, KotlinRoutesBuilderLoader$doLoadEndpointRouteBuilder$$inlined$createJvmCompilationConfigurationFromTemplate$default$1-1.class, KotlinRoutesBuilderLoader$doLoadEndpointRouteBuilder$$inlined$createJvmCompilationConfigurationFromTemplate$default$1.class, KotlinRoutesBuilderLoader$doLoadEndpointRouteBuilder$result$1-1.class, KotlinRoutesBuilderLoader$doLoadEndpointRouteBuilder$result$1.class, KotlinRoutesBuilderLoader-1.class, KotlinRoutesBuilderLoader.class, KotlinRoutesBuilderLoader.kt, KotlinRoutesBuilderLoaderTest.class, KotlinRoutesBuilderLoaderTest.kt, LICENSE.txt, LanguagesConfiguration-1.class, LanguagesConfiguration.class, LanguagesConfiguration.kt, MANIFEST.MF, MyBean.class, MyBean.kt, NOTICE.txt, RegistryConfiguration-1.class, RegistryConfiguration.class, RegistryConfiguration.kt, RestConfiguration-1.class, RestConfiguration.class, RestConfiguration.kt, RestVerbConfiguration-1.class, RestVerbConfiguration.class, RestVerbConfiguration.kt, build-history.bin, camel-kotlin-dsl-1.kotlin_module, camel-kotlin-dsl-2.kotlin_module, camel-kotlin-dsl-3.20.0-SNAPSHOT-sources.jar, camel-kotlin-dsl-3.20.0-SNAPSHOT.jar, camel-kotlin-dsl-3.20.0-SNAPSHOT.pom, camel-kotlin-dsl.kotlin_module, class-attributes.tab, class-attributes.tab.keystream, class-attributes.tab.keystream.len, class-attributes.tab.len, class-attributes.tab.values.at, class-attributes.tab_i, class-attributes.tab_i.len, class-fq-name-to-source.tab, class-fq-name-to-source.tab.keystream, class-fq-name-to-source.tab.keystream.len, class-fq-name-to-source.tab.len, class-fq-name-to-source.tab.values.at, class-fq-name-to-source.tab_i, class-fq-name-to-source.tab_i.len, constants.tab, constants.tab.keystream, constants.tab.keystream.len, constants.tab.len, constants.tab.values.at, constants.tab_i, constants.tab_i.len, counters.tab, file-to-id.tab, file-to-id.tab.keystream, file-to-id.tab.keystream.len, file-to-id.tab.len, file-to-id.tab.values.at, file-to-id.tab_i, file-to-id.tab_i.len, id-to-file.tab, id-to-file.tab.keystream, id-to-file.tab.keystream.len, id-to-file.tab.len, id-to-file.tab.values.at, id-to-file.tab_i, id-to-file.tab_i.len, inline-functions.tab, inline-functions.tab.keystream, inline-functions.tab.keystream.len, inline-functions.tab.len, inline-functions.tab.values.at, inline-functions.tab_i, inline-functions.tab_i.len, internal-name-to-source.tab, internal-name-to-source.tab.keystream, internal-name-to-source.tab.keystream.len, internal-name-to-source.tab.len, internal-name-to-source.tab.values.at, internal-name-to-source.tab_i, internal-name-to-source.tab_i.len, jandex.idx, kotlin-dsl-1.json, kotlin-dsl.adoc, kotlin-dsl.json, kts, kts-1, last-build.bin, log4j2-test-1.properties, log4j2-test.properties, lookups.tab, lookups.tab.keystream, lookups.tab.keystream.len, lookups.tab.len, lookups.tab.values.at, lookups.tab_i, lookups.tab_i.len, org.apache.felix_maven-bundle-plugin_manifest_xx, other-1.properties, other.properties, package-parts.tab, package-parts.tab.keystream, package-parts.tab.keystream.len, package-parts.tab.len, package-parts.tab.values.at, package-parts.tab_i, package-parts.tab_i.len, pom.properties, pom.xml, proto.tab, proto.tab.keystream, proto.tab.keystream.len, proto.tab.len, proto.tab.values.at, proto.tab_i, proto.tab_i.len, routes-1.kts, routes-new-1.kts, routes-new.kts, routes-with-beans-1.kts, routes-with-beans.kts, routes-with-components-configuration-1.kts, routes-with-components-configuration-error-1.kts, routes-with-components-configuration-error.kts, routes-with-components-configuration.kts, routes-with-dataformats-configuration-1.kts, routes-with-dataformats-configuration.kts, routes-with-endpoint-dsl-1.kts, routes-with-endpoint-dsl.kts, routes-with-error-handler-1.kts, routes-with-error-handler.kts, routes-with-languages-configuration-1.kts, routes-with-languages-configuration.kts, routes-with-rest-1.kts, routes-with-rest.kts, routes.kts, snapshots.bin, source-snapshot.tab, source-snapshot.tab.keystream, source-snapshot.tab.keystream.len, source-snapshot.tab.len, source-snapshot.tab.values.at, source-snapshot.tab_i, source-snapshot.tab_i.len, source-to-classes.tab, source-to-classes.tab.keystream, source-to-classes.tab.keystream.len, source-to-classes.tab.len, source-to-classes.tab.values.at, source-to-classes.tab_i, source-to-classes.tab_i.len, source-to-output.tab, source-to-output.tab.keystream, source-to-output.tab.keystream.len, source-to-output.tab.len, source-to-output.tab.values.at, source-to-output.tab_i, source-to-output.tab_i.len, subtypes.tab, subtypes.tab.keystream, subtypes.tab.keystream.len, subtypes.tab.len, subtypes.tab.values.at, subtypes.tab_i, subtypes.tab_i.len, supertypes.tab, supertypes.tab_i, supertypes.tab_i.len
>
>
> If you have a route like:
> {code:java}
> # camel-k: dependency=mvn:software.amazon.awssdk:dynamodb:2.17.290
> - route:
>     from:
>       uri: "kamelet:kafka-not-secured-source"
>       parameters:
>         bootstrapServers: localhost:9092
>         topic: ddb-topic
>       steps:
>         - to: 
>             uri: "kamelet:aws-ddb-sink"
>             parameters:
>               accessKey: access
>               secretKey: sec
>               region: reg
>               table: "test"
> {code}
> Then camel-jbang will fail with
> {code:java}
> Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.services.dynamodb.model.AttributeValue
>     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
>     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>     ... 44 more
> {code}
> the command is: jbang run --fresh -Dcamel.jbang.version=3.19.0 camel@apache/camel run kafka-source-ddb.yaml
> This will fail with 3.20.0-SNAPSHOT too and by using --deps from cli



--
This message was sent by Atlassian Jira
(v8.20.10#820010)