Repository navigation
fix(#707): register the simple-no-file language in the camel-core-languages bundle - #708
Merged
Merged
Conversation
jbonofre
self-requested a review
July 27, 2026 05:13
jbonofre
approved these changes
Jul 27, 2026
This was referenced Jul 27, 2026
oscerd
approved these changes
Sep 2, 2026
…sion test The class the service entry points at is already shipped, unchanged, in the shaded camel-core-languages bundle, and Activator.BaseResolver loads it by name from that file -- the @language annotation is never read at runtime. The local copy of SimpleNoFileLanguage, the camel-api and camel-support dependencies it needed to compile, and the Export-Package narrowing those dependencies forced are therefore all unnecessary: - The local copy shadowed the upstream class in the shaded jar, so a future Camel change to SimpleNoFileLanguage would have been silently overridden with no build failure. - camel-api/camel-support were compile scope and, since the root pom sets createDependencyReducedPom=false, would have leaked into the published pom of the bundle and onto the classpath of every consumer. - Restoring the conventional org.apache.camel* export with those dependencies present makes bnd inline all of camel-api and camel-support into the bundle (412 KB -> 1.9 MB) and duplicate-export packages that core/camel-api and core/camel-support already provide. Replace the shade IncludeResourceTransformer with a <resource> entry: the module's <resources> block overrides Maven's default src/main/resources, which is why the file did not reach the bundle on its own. The transformer would also have hard-failed the build with "duplicate entry" if Apache Camel ever ships its own simple-no-file service file, whereas shade dedupes jar entries silently. Add the ASF licence header the file was missing; apache-rat rejected it, which breaks the release profile. java.util.Properties, used to parse the file, ignores the # comments. The resulting bundle is identical to the one built from main except for the added service entry, with an unchanged Export-Package. Add a Pax Exam regression test in tests/features/camel-core covering a pollEnrich with a dynamic file endpoint, the scenario reported in the issue.
Member
|
Rebased this branch onto current
@robinvish2794 heads-up: this PR's head is your fork's For future PRs, a topic branch (e.g. Claude Code on behalf of Jean-Baptiste Onofré |
jbonofre
added a commit
that referenced
this pull request
Sep 7, 2026
…est (backport of #708) (#751) The class the service entry points at is already shipped, unchanged, in the shaded camel-core-languages bundle, and Activator.BaseResolver loads it by name from that file -- the @language annotation is never read at runtime. The local copy of SimpleNoFileLanguage, the camel-api and camel-support dependencies it needed to compile, and the Export-Package narrowing those dependencies forced are therefore all unnecessary: - The local copy shadowed the upstream class in the shaded jar, so a future Camel change to SimpleNoFileLanguage would have been silently overridden with no build failure. - camel-api/camel-support were compile scope and, since the root pom sets createDependencyReducedPom=false, would have leaked into the published pom of the bundle and onto the classpath of every consumer. - Restoring the conventional org.apache.camel* export with those dependencies present makes bnd inline all of camel-api and camel-support into the bundle (412 KB -> 1.9 MB) and duplicate-export packages that core/camel-api and core/camel-support already provide. Replace the shade IncludeResourceTransformer with a <resource> entry: the module's <resources> block overrides Maven's default src/main/resources, which is why the file did not reach the bundle on its own. The transformer would also have hard-failed the build with "duplicate entry" if Apache Camel ever ships its own simple-no-file service file, whereas shade dedupes jar entries silently. Add the ASF licence header the file was missing; apache-rat rejected it, which breaks the release profile. java.util.Properties, used to parse the file, ignores the # comments. The resulting bundle is identical to the one built from main except for the added service entry, with an unchanged Export-Package. Add a Pax Exam regression test in tests/features/camel-core covering a pollEnrich with a dynamic file endpoint, the scenario reported in the issue. (cherry picked from commit 9d57b59)
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.
Fixes #707.
Problem
pollEnrich(orpoll) driven by asimpleexpression fails in Karaf with:PollEnrichReifierrewrites asimpleexpression to the internalsimple-no-filelanguage. Apache Camel ships noMETA-INF/services/org/apache/camel/language/simple-no-file—DefaultLanguageResolverresolves that name through a hardcoded branch instead:camel-karaf replaces that resolver with
OsgiLanguageResolver, which looks languages up in the OSGi service registry and has no such branch. Its last fallback, aLanguageResolverservice registered underresolver=default, no longer exists in Camel 4.18.1 (no artifact shipsMETA-INF/services/org/apache/camel/language/resolver/default), so resolution ends inNoSuchLanguageException.Fix
Ship the service entry in the
camel-core-languagesbundle.Activatorthen registers aLanguageResolverservice withlanguage=simple-no-file, andOsgiLanguageResolverfinds it.The class the entry points at,
org.apache.camel.language.simple.SimpleNoFileLanguage, is already present and unchanged in the shaded bundle, andActivator.BaseResolverloads it by name from the service file.Mirroring the flat-classpath branch inside
OsgiLanguageResolverwas considered and rejected:OsgiClassResolverloads through the route bundle's classloader, and route bundles do not importorg.apache.camel.language.simple. Going through the service registry means the exporting bundle loads its own class, which is robust regardless of the consumer's wiring.Changes
core/camel-core-languages/src/main/resources/META-INF/services/org/apache/camel/language/simple-no-file— the service entry, with the ASF header and a note recording why camel-karaf ships an entry Camel deliberately omits, so a future Camel upgrade does not drop it.core/camel-core-languages/pom.xml— declaresrc/main/resourcesexplicitly. The module's existing<resources>block replaces Maven's default resource directory, which is why the file would otherwise never reach the bundle.tests/features/camel-core— Pax Exam regression test driving apollEnrichwith a dynamic file endpoint, the scenario from the issue.Verification
mainexcept for the added service entry, with an unchangedExport-Package.CamelCoreITest: 5/5 pass. With the service entry removed,testCamelPollEnrichfails (mock://camel-poll-enrich-test Received message count. Expected: <1> but was: <0>— the route never starts), so the test does catch the regression.apache-rat:checkpasses on the module; it failed before the licence header was added, which would have broken the release profile.Note on the changeset
The original commit also added a local copy of
SimpleNoFileLanguage,camel-api/camel-supportdependencies, and a narrowedExport-Package. Those have been removed as unnecessary, because the annotation they carried is never read at runtime:createDependencyReducedPom=false, would have leaked into the bundle's published pom and onto every consumer's classpath;org.apache.camel*export with those dependencies present makes bnd inline all of camel-api and camel-support into the bundle (412 KB → 1.9 MB) and duplicate-export packages thatcore/camel-apiandcore/camel-supportalready provide.The shade
IncludeResourceTransformerwas likewise replaced by the<resource>entry: it would have hard-failed the build withduplicate entryif Apache Camel ever ships its ownsimple-no-fileservice file, whereas shade dedupes jar entries silently.