This is an automated email from the ASF dual-hosted git repository. tballison pushed a commit to branch TIKA-4865-grpc-plugins in repository https://gitbox.apache.org/repos/asf/tika.git
commit 04a59add806cba63404d5ab7a62ddaf90e0ea062 Author: tallison <[email protected]> AuthorDate: Mon Aug 31 14:26:15 2026 -0400 TIKA-4865 -- tika-grpc: resolve the plugin-roots fallback via DefaultPluginsDir and WARN when no plugins directory exists --- 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 3cf56dbe65..f464f9ac20 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 default plugins directory is resolved against the install layout (next to the jar, or next to its lib/ directory) and always as an absolute path, shared by tika-server, PipesForkParser and the async 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; } }
