Skip to content

TIKA-4703: Fix tika-grpc Docker image missing runtime dependencies - #2790

Merged
nddipiazza merged 4 commits into
mainfrom
TIKA-4703-fix-grpc-missing-lib-deps
Apr 27, 2026
Merged

TIKA-4703: Fix tika-grpc Docker image missing runtime dependencies#2790
nddipiazza merged 4 commits into
mainfrom
TIKA-4703-fix-grpc-missing-lib-deps

Conversation

@nddipiazza

@nddipiazza nddipiazza commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The tika-grpc Docker image was failing to start with:

Error: Unable to initialize main class org.apache.tika.pipes.grpc.TikaGrpcServer
Caused by: java.lang.NoClassDefFoundError: io/grpc/BindableService

Root Cause

The Docker build context only copied the thin jar (tika-grpc-X.jar) but not its runtime dependencies. The jar's MANIFEST.MF has Class-Path: tika-grpc/grpc-stub-X.jar tika-grpc/grpc-netty-shaded-X.jar ... (set by classpathPrefix in maven-jar-plugin), so Java looks for deps relative to the jar — and they were not present in the image.

Changes

  • tika-grpc/pom.xml: Changed classpathPrefix from lib/ to tika-grpc/ so the MANIFEST.MF Class-Path entries match the actual directory layout in the image
  • docker-snapshot.yml / docker-release.yml: Use mvn dependency:copy-dependencies to collect runtime deps into libs/tika-grpc/ alongside the main jar; consolidate into a single Prepare step
  • Smoke tests: All three images (tika-server minimal, tika-server full, tika-grpc) now have a smoke test step that builds a single-arch image with --load, starts the container, and polls for the startup log line before the final multi-arch push — CI fails if the server doesn't start within the timeout

Final image layout

/tika/libs/tika-grpc-X.jar        ← main jar
/tika/libs/tika-grpc/*.jar         ← runtime deps (matches MANIFEST Class-Path)

Critical Files

  • tika-grpc/pom.xml
  • .github/workflows/docker-snapshot.yml
  • .github/workflows/docker-release.yml

Testing

Smoke tested locally — all three images start cleanly:

  • tika-grpc: Server started, listening on 9090
  • tika-server minimal: Started Apache Tika server ... at http://0.0.0.0:9998/

@nddipiazza
nddipiazza requested a review from Copilot April 27, 2026 13:50
@nddipiazza
nddipiazza force-pushed the TIKA-4703-fix-grpc-missing-lib-deps branch from 799b436 to bf22314 Compare April 27, 2026 13:52
Use 'mvn dependency:copy-dependencies' to populate the lib/ directory of
runtime jars that the MANIFEST.MF Class-Path entries reference. Without
this the image only contained the thin jar and Java threw:

  NoClassDefFoundError: io/grpc/BindableService

The jar's MANIFEST.MF (set by maven-jar-plugin classpathPrefix=lib/) expects
dependencies at lib/ relative to the jar, i.e. /tika/libs/lib/ in the image.
Running dependency:copy-dependencies into that path after the main build
ensures all runtime deps are present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nddipiazza
nddipiazza force-pushed the TIKA-4703-fix-grpc-missing-lib-deps branch from bf22314 to 8b6dd80 Compare April 27, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the tika-grpc Docker image startup failure caused by missing runtime dependency jars referenced via MANIFEST.MF Class-Path, by ensuring the Docker build context includes both the thin jar and its lib/ directory as produced by the Maven assembly zip.

Changes:

  • Update the snapshot Docker workflow to unzip the tika-grpc assembly zip and copy both tika-grpc-*.jar and lib/*.jar into the image build context.
  • Update the release Docker workflow to do the same for tagged releases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/docker-snapshot.yml Switches tika-grpc build context packaging from copying only the jar to extracting jar + lib/ from the assembly zip.
.github/workflows/docker-release.yml Applies the same assembly-zip extraction approach for release builds to ensure runtime deps are present in the image.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

nddipiazza and others added 2 commits April 27, 2026 09:08
…c smoke test

- Rename classpathPrefix from lib/ to tika-grpc/ in maven-jar-plugin so
  MANIFEST.MF Class-Path matches the actual directory layout in the image
- Update docker-snapshot.yml and docker-release.yml: rename libs/lib -> libs/tika-grpc,
  consolidate separate 'Collect' + 'Prepare' steps into a single Prepare step
- Add smoke test to docker-snapshot.yml: builds single-arch image with --load,
  starts container, polls for 'Server started' log line, fails CI if not seen within 30s

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ages

- Build single-arch (amd64) image with --load before each multi-arch push
- Poll for 'Started Apache Tika server' log line for up to 40 seconds
- Fail CI job if server does not start; dump logs on failure
- tika-server has no missing-deps issue (bin.tgz already bundles lib/)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nddipiazza
nddipiazza requested a review from Copilot April 27, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/docker-snapshot.yml Outdated
Comment thread .github/workflows/docker-snapshot.yml Outdated
Comment thread .github/workflows/docker-release.yml
Comment thread tika-grpc/pom.xml
Comment thread .github/workflows/docker-snapshot.yml Outdated
…ke tests

- Update assembly.xml outputDirectory from lib/ to tika-grpc/ to match
  classpathPrefix in pom.xml; without this the binary zip would have deps
  under lib/ while MANIFEST.MF Class-Path references tika-grpc/*.jar
- Replace bare docker stop/exit in all three smoke test steps with a trap
  cleanup function using docker rm -f; this prevents bash -e from failing
  on a stop of an already-exited container and ensures logs are always
  collected on failure

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nddipiazza
nddipiazza requested a review from Copilot April 27, 2026 14:39
@nddipiazza
nddipiazza merged commit bcfc0ea into main Apr 27, 2026
6 of 7 checks passed
@nddipiazza
nddipiazza removed the request for review from Copilot April 27, 2026 15:04
@tballison
tballison deleted the TIKA-4703-fix-grpc-missing-lib-deps branch September 3, 2026 21:54
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.

3 participants