You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2026/09/26 15:22:23 UTC

[PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

ppkarwasz opened a new pull request, #3260:
URL: https://github.com/apache/tika/pull/3260

   [TIKA-4934](https://issues.apache.org/jira/browse/TIKA-4934)
   
   `tika-bundle-standard` is meant to embed only the dependencies that aren't OSGi bundles themselves, but it also embedded many that ship proper OSGi manifests. This PR stops embedding them. It also fixes PDF parsing in OSGi, which failed because `pdfbox-io` was never embedded:
   
   ```
   java.lang.NoClassDefFoundError: org/apache/pdfbox/io/RandomAccessReadBuffer
   Caused by: java.lang.ClassNotFoundException: org.apache.pdfbox.io.RandomAccessReadBuffer not found by org.apache.tika.bundle-standard
   ```
   
   ### No longer embedded (must be deployed as separate bundles)
   
   commons-io, commons-codec, commons-collections4, commons-compress, commons-csv, commons-exec, commons-lang3, commons-math3, xz, pdfbox, fontbox, pdfbox-io, commons-logging (1.4+; `jcl-over-slf4j` only exports 1.2), bcprov/bcpkix/bcutil/bcjmail, jsoup, asm, xmpcore, dd-plist.
   
   ### Still embedded, although they are bundles
   
   - `apache-mime4j-core`/`-dom`: they import `org.apache.commons.io;version="[1.4,2)"`, which commons-io 2.x doesn't satisfy.
   - `rome`: it requires `org.jdom2`, which isn't a bundle.
   - `jackcess`/`jackcess-encrypt`: jackcess uses `org.apache.poi.poifs.filesystem` for OLE attachments, and POI only exists inside the bundle.
   
   ### Tests
   
   `BundleIT` now:
   - installs every jar that `test-bundles.xml` copies to `target/test-bundles`;
   - asserts that all bundles are active;
   - checks that classes from each external dependency load through the bundle that uses it. Every import of `tika-bundle-standard` is optional, so without this check a missing bundle wouldn't fail the test;
   - parses a PDF inside the container. This test fails on current `main` with the error above.
   
   The PDF test calls `PDFParser` directly. Parsing through the registered `Parser` service overflows the stack: `TikaActivator` passes the `DefaultParser` service registered by `BundleActivator` back into `ServiceLoader` as a dynamic provider, and `DefaultParser.getParsers()` then includes itself. That's a separate issue.
   
   ### Compatibility
   
   OSGi deployments of `tika-bundle-standard` need the bundles listed above. `CHANGES.txt` only has the in-progress 4.1.0 section, so I didn't add an entry. I'm happy to add one wherever you prefer.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-6000903437

   Hi @tballison,
   
   Thanks! I didn't have a chance to review the other two, but go ahead and merge: I'll look at them if I find some time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-5877580756

   This looks great. Should we fix the stackoverflow first?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-5878104962

   From my :robot: 
   ```
   Thanks, the direction looks right, and the new BundleIT checks are great. A few things before merge:
   
   1. **Make the imports of the un-embedded bundles mandatory.** They currently come in through `*;resolution:=optional`, so an OSGi deployment that misses one of the new bundles still resolves and then fails with `NoClassDefFoundError` mid-parse. With explicit, non-optional imports, Felix refuses to resolve and names the missing package.
   
   2. **Floor the versions at what Tika builds with.** bnd's defaults allow older patch releases than we test (`org.apache.pdfbox` `[3.0,4)`, `org.apache.commons.compress` `[1.28,2)`), and `org.apache.commons.io` comes out as `[1.4,2)` (from mime4j's import). That range is only satisfied by commons-io 2.22 through its `1.4.9999` compat export, and a real 1.4 bundle would satisfy it too.
   
   The attached patch does both, using the parent-pom version properties so dependabot bumps carry through. BouncyCastle stays literal because its packages export major.minor only. `com.adobe.internal.xmp.impl` and `org.apache.pdfbox.debugger` stay optional since no deployed bundle exports them. With it, BundleIT passes, and removing `commons-compress.jar` from `target/test-bundles` makes the bundle fail resolution with `missing requirement ... osgi.wiring.package`.
   
   3. **CHANGES:** main now has a 4.2.0 section; please add an entry listing the bundles OSGi users must now install.
   
   4. **PDF test:** the `DefaultParser` recursion you found is fixed in TIKA-4942 (the detector recursed the same way). Once that's merged, could `testPdfParsing` go through the registered `Parser` service instead of `PDFParser` directly?
   
   Minor: the description says commons-io 2.x doesn't satisfy mime4j's `[1.4,2)`. It does, via the compat export mentioned above. Keeping mime4j embedded is fine either way.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison merged PR #3260:
URL: https://github.com/apache/tika/pull/3260


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-5878092705

   [20260928-tika-4934-mandatory-imports.patch](https://github.com/user-attachments/files/32772909/20260928-tika-4934-mandatory-imports.patch)
   
   My :robot: recommended the attached. I don't know enought about osgi to know if these are a good addition or a slop-grenade. @ppkarwasz please help me discern the difference.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [TIKA-4934] tika-bundle-standard: do not embed dependencies that are OSGi bundles [tika]

Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on PR #3260:
URL: https://github.com/apache/tika/pull/3260#issuecomment-6000788386

   I'm going to merge this and the two other open OSGi related PRs. There's some follow on work to do, and I'd appreciate a look on that follow on work. 
   
   Thank you @ppkarwasz !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org