Skip to content

fix(#713): add missing transitive dependencies to camel-tika feature (backport of #716) - #724

Open
jbonofre wants to merge 3 commits into
apache:camel-karaf-4.18.xfrom
jbonofre:backport-716-camel-tika-deps-4.18.x
Open

fix(#713): add missing transitive dependencies to camel-tika feature (backport of #716)#724
jbonofre wants to merge 3 commits into
apache:camel-karaf-4.18.xfrom
jbonofre:backport-716-camel-tika-deps-4.18.x

Conversation

@jbonofre

@jbonofre jbonofre commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

Backport of #716 to camel-karaf-4.18.x.

Fixes #713. The camel-tika feature was missing several transitive runtime dependencies of the Tika parser modules it installs, so tika:detect / tika:parse fail at runtime with NoClassDefFoundError.

Dependency tree of camel-tika (Tika 3.2.3):

Module Transitive dep Was in feature? OSGi bundle? Fix
tika-parser-html-module org.jsoup:jsoup plain mvn:
tika-parser-html-module commons-codec:commons-codec plain mvn:
tika-parser-text-module org.apache.commons:commons-csv plain mvn:
tika-parser-text-module com.github.albfernandez:juniversalchardet ❌ (no manifest) wrap:

org.apache.tika.parser.txt.UniversalEncodingListener needs org.mozilla.universalchardet.* from juniversalchardet, which is why charset detection/text parsing broke.

Changes

  • features/src/main/feature/camel-features.xml — add jsoup, commons-codec, commons-csv (plain bundles) and juniversalchardet (via wrap:, as it ships no OSGi metadata) to the camel-tika feature.
  • pom.xml — bump the stale, previously-unused juniversalchardet-version from 1.0.3 (the old com.googlecode.juniversalchardet groupId) to 2.5.0, matching what Tika 3.2.3 pulls in (com.github.albfernandez).
  • tests/features/camel-tika — new Pax Exam integration test (direct → tika:parse?tikaParseOutputFormat=text → mock) asserting the feature installs and the route processes one exchange end-to-end, plus the <module> entry.

Scope of the integration test

The test deliberately does not assert on the extracted text. Tika's AutoDetectParser discovers parsers through the JDK ServiceLoader, which does not cross OSGi bundle boundaries, so tika:parse yields empty content in Karaf. Wiring Tika's parser SPI for OSGi is a separate concern beyond the scope of #713.

What the test does prove is exactly what #713 fixes: before the change the tika-parser-text-module bundle could not wire (missing org.mozilla.universalchardet), so the route never started and no message reached the mock.

Backport fidelity

The changeset is identical to the version merged to main in #716 (commit 414562ee1), with the single intended difference that the test module's parent version is 4.18.3-SNAPSHOT to match this branch.

The initial push of this backport carried the pre-fix revision of the itest (from #716's first commit), which still asserted on the parsed content and failed CI on both Java 17 and Java 21. It has been realigned with the merged version.

jbonofre and others added 3 commits July 29, 2026 06:03
…ature

The camel-tika feature was missing the transitive runtime dependencies of
tika-parser-html-module (jsoup, commons-codec) and tika-parser-text-module
(commons-csv, juniversalchardet). Without them, tika operations such as
tika:detect/tika:parse fail at runtime with NoClassDefFoundError (e.g.
org.apache.tika.parser.txt.UniversalEncodingListener needs
org.mozilla.universalchardet.*).

jsoup, commons-codec and commons-csv are already proper OSGi bundles and are
added as plain mvn: bundles. com.github.albfernandez:juniversalchardet 2.5.0
ships without OSGi metadata, so it is installed via wrap:.

The stale, unused juniversalchardet-version property (1.0.3, the old
com.googlecode groupId) is bumped to 2.5.0 to match the version Tika 3.2.3
pulls in.

Adds a Pax Exam integration test (tests/features/camel-tika) that parses a
plain-text body through tika:parse, exercising the text parser and its
juniversalchardet dependency at runtime.
…ika test module

The backported camel-tika test module referenced its parent
camel-karaf-features-test as 4.18.2-SNAPSHOT, but the branch is on the
4.18.3-SNAPSHOT development iteration, causing a non-resolvable parent
POM error that failed the CI build.
Align the backported itest with the version merged to main in apache#716.

The test asserted that tika:parse extracts text, but in Karaf tika:parse
returns empty content: Tika's AutoDetectParser discovers parsers through the
JDK ServiceLoader, which does not cross OSGi bundle boundaries. Wiring Tika's
parser SPI for OSGi is out of scope for issue apache#713, whose fix is the missing
juniversalchardet bundle so tika-parser-text-module resolves.

Scope the test to what apache#713 fixes: the feature installs and the tika:parse
route processes one exchange end-to-end (expectedMessageCount(1)). Before the
fix the tika-parser-text-module bundle could not wire (missing
org.mozilla.universalchardet), so the route never started and no message
reached the mock.
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

Successfully merging this pull request may close these issues.

1 participant