CAMEL-23939: Fix Kamelet dependencies ignored in Camel CLI#24544
Merged
Conversation
When running via Camel CLI, Kamelet-declared dependencies (e.g. camel:jackson-avro) are downloaded into a child classloader but DelegatingSchemaResolver is loaded by the parent classloader and cannot see them, causing NoClassDefFoundError. Fix by adding a reflection-based fallback: direct instantiation is tried first (works on flat classpaths like Spring Boot), and on NoClassDefFoundError the resolver is loaded via CamelContext's ClassResolver which can see dynamically downloaded JARs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 12 tested, 29 compile-only — current: 12 all testedMaveniverse Scalpel detected 41 affected modules (current approach: 12).
|
oscerd
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude Code on behalf of davsclaus
DelegatingSchemaResolverfailing withNoClassDefFoundErrorwhen running Kamelets via Camel CLIAvroSchemaResolver,ProtobufSchemaResolver,JsonSchemaResolverfromprovided-scope dependencies that are downloaded into a child classloader at runtimenewis tried first (works on flat classpaths like Spring Boot), and onNoClassDefFoundErrorthe resolver is loaded reflectively viaCamelContext.getClassResolver()which can see dynamically downloaded JARsCamelContextAwareto get access to theClassResolverRoot Cause
When
DelegatingSchemaResolverwas moved fromcamel-kameletsintocamel-kamelet(CAMEL-21249), it ended up on the boot classpath while itsprovideddependencies (camel-jackson-avro,camel-jackson-protobuf,camel-jackson) are dynamically downloaded into a childDependencyDownloaderClassLoader. Parent-first delegation means the parent classloader (which loadedDelegatingSchemaResolver) cannot see the child's JARs.Test plan
camel-kamelettests pass (flat classpath path exercised)camel runusing a Kamelet that declarescamel:jackson-avrodependency🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com