This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 314b35eb7d TIKA-4865 -- tika-grpc: resolve the plugin-roots fallback
via DefaultPluginsDir and WARN when no plugins directory exists (#3109)
314b35eb7d is described below
commit 314b35eb7d8e283dc8f4faacb66899e27009b319
Author: Tim Allison <[email protected]>
AuthorDate: Mon Aug 31 16:21:07 2026 -0400
TIKA-4865 -- tika-grpc: resolve the plugin-roots fallback via
DefaultPluginsDir and WARN when no plugins directory exists (#3109)
---
CHANGES.txt | 5 +++++
.../org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java | 17 +++++++++++++++--
.../tika/pipes/core/config/DefaultPluginsDir.java | 12 +++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 814c07cd27..664e3ebb98 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,10 @@
Release 4.1.0 - unreleased
+ * tika-grpc resolves its plugin-roots fallback against the install
+ layout via DefaultPluginsDir instead of a working-directory-relative
+ pf4j default, and a WARN names the resolved directory when no plugins
+ directory exists (TIKA-4865).
+
* The tika-server full and tika-grpc Docker images install fonts-noto-cjk:
without any CJK face, PDFs using non-embedded CJK fonts render (and OCR)
as .notdef boxes in every renderer, even though the images ship Japanese
diff --git
a/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
b/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
index 59bc83d28b..9608c2d504 100644
--- a/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
+++ b/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
@@ -54,6 +54,7 @@ import org.apache.tika.pipes.core.PipesException;
import org.apache.tika.pipes.core.PipesParser;
import org.apache.tika.pipes.core.config.ConfigStore;
import org.apache.tika.pipes.core.config.ConfigStoreFactory;
+import org.apache.tika.pipes.core.config.DefaultPluginsDir;
import org.apache.tika.pipes.core.fetcher.FetcherManager;
import org.apache.tika.pipes.grpc.proto.DeleteFetcherReply;
import org.apache.tika.pipes.grpc.proto.DeleteFetcherRequest;
@@ -135,8 +136,20 @@ class TikaGrpcServerImpl extends TikaGrpc.TikaImplBase {
pluginManager.loadPlugins();
pluginManager.startPlugins();
} catch (TikaConfigException e) {
- LOG.warn("Could not load plugin manager, using default: {}",
e.getMessage());
- pluginManager = new org.pf4j.DefaultPluginManager();
+ // plugin-roots not configured: probe the install layout like the
+ // other pipes entry points (TIKA-4864/TIKA-4865)
+ String defaultRoot =
DefaultPluginsDir.resolve(TikaGrpcServerImpl.class);
+ LOG.warn("plugin-roots not configured ({}); falling back to {}",
+ e.getMessage(), defaultRoot);
+ try {
+ pluginManager = TikaPluginManager.loadFromPaths(defaultRoot);
+ pluginManager.loadPlugins();
+ pluginManager.startPlugins();
+ } catch (TikaConfigException | IOException e2) {
+ LOG.warn("could not load plugins from {}, starting with none:
{}",
+ defaultRoot, e2.getMessage());
+ pluginManager = new org.pf4j.DefaultPluginManager();
+ }
}
if (pluginManager.getPlugins().isEmpty()) {
diff --git
a/tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config/DefaultPluginsDir.java
b/tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config/DefaultPluginsDir.java
index 913fe49e69..8e08f07f18 100644
---
a/tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config/DefaultPluginsDir.java
+++
b/tika-pipes/tika-pipes-core/src/main/java/org/apache/tika/pipes/core/config/DefaultPluginsDir.java
@@ -19,6 +19,9 @@ package org.apache.tika.pipes.core.config;
import java.nio.file.Files;
import java.nio.file.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Resolves the default {@code plugins} directory when {@code plugin-roots}
* is not configured (TIKA-4864). The probe order matches the install
@@ -37,6 +40,8 @@ import java.nio.file.Path;
*/
public final class DefaultPluginsDir {
+ private static final Logger LOG =
LoggerFactory.getLogger(DefaultPluginsDir.class);
+
/**
* The directory name probed in each location.
*/
@@ -88,6 +93,11 @@ public final class DefaultPluginsDir {
}
}
}
- return cwd.resolve(PLUGINS_DIR_NAME).toAbsolutePath();
+ Path fallback = cwd.resolve(PLUGINS_DIR_NAME).toAbsolutePath();
+ if (!Files.isDirectory(fallback)) {
+ LOG.warn("no plugins directory found in the install layout or at
{}; "
+ + "pipes plugins will not load unless plugin-roots is
configured", fallback);
+ }
+ return fallback;
}
}