Skip to content

CAMEL-23939: Fix Kamelet dependencies ignored in Camel CLI#24544

Merged
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-23939
Jul 9, 2026
Merged

CAMEL-23939: Fix Kamelet dependencies ignored in Camel CLI#24544
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-23939

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

  • Fix DelegatingSchemaResolver failing with NoClassDefFoundError when running Kamelets via Camel CLI
  • The class has hard imports to AvroSchemaResolver, ProtobufSchemaResolver, JsonSchemaResolver from provided-scope dependencies that are downloaded into a child classloader at runtime
  • Add a try/catch fallback: direct new is tried first (works on flat classpaths like Spring Boot), and on NoClassDefFoundError the resolver is loaded reflectively via CamelContext.getClassResolver() which can see dynamically downloaded JARs
  • Implement CamelContextAware to get access to the ClassResolver

Root Cause

When DelegatingSchemaResolver was moved from camel-kamelets into camel-kamelet (CAMEL-21249), it ended up on the boot classpath while its provided dependencies (camel-jackson-avro, camel-jackson-protobuf, camel-jackson) are dynamically downloaded into a child DependencyDownloaderClassLoader. Parent-first delegation means the parent classloader (which loaded DelegatingSchemaResolver) cannot see the child's JARs.

Test plan

  • Existing camel-kamelet tests pass (flat classpath path exercised)
  • Manual verification with camel run using a Kamelet that declares camel:jackson-avro dependency

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

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>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-kamelet

🔬 Scalpel shadow comparison — Scalpel: 12 tested, 29 compile-only — current: 12 all tested

Maveniverse Scalpel detected 41 affected modules (current approach: 12).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 12 modules (1 direct + 11 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (12)
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-kamelet
  • camel-launcher-container
  • camel-test-main-junit5
  • camel-test-main-junit6
  • camel-xml-io-dsl
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (41 modules)
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: Test :: Main :: JUnit5
  • Camel :: Test :: Main :: JUnit6
  • Camel :: XML DSL with camel-xml-io
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus added the bug Something isn't working label Jul 9, 2026
@davsclaus davsclaus self-assigned this Jul 9, 2026
@davsclaus davsclaus added this to the 4.22.0 milestone Jul 9, 2026
@davsclaus davsclaus merged commit 57359ca into main Jul 9, 2026
5 checks passed
@davsclaus davsclaus deleted the fix/CAMEL-23939 branch July 9, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants