This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a commit to branch file-based-config-store
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/file-based-config-store by 
this push:
     new 7892162ee Use plugin classloader for Ignite server startup
7892162ee is described below

commit 7892162ee557ecd0314dadefa6aade10a725b25b
Author: Nicholas DiPiazza <[email protected]>
AuthorDate: Sun Dec 28 15:17:40 2025 -0600

    Use plugin classloader for Ignite server startup
    
    - Find Ignite plugin's classloader from plugin manager
    - Load IgniteStoreServer and CacheMode using plugin classloader
    - Fixes NoClassDefFoundError for H2 classes
    - Ensures all Ignite dependencies (including H2) are available
    - Plugin classloader has all dependencies from lib/ directory
---
 .../apache/tika/pipes/grpc/TikaGrpcServerImpl.java | 24 +++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

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 f575aa56b..64a8d554b 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
@@ -154,9 +154,27 @@ class TikaGrpcServerImpl extends TikaGrpc.TikaImplBase {
             String cacheMode = params.has("cacheMode") ? 
params.get("cacheMode").asText() : "REPLICATED";
             String instanceName = params.has("igniteInstanceName") ? 
params.get("igniteInstanceName").asText() : "TikaIgniteServer";
             
-            // Dynamically load and start server (avoid compile-time 
dependency)
-            Class<?> serverClass = 
Class.forName("org.apache.tika.pipes.ignite.server.IgniteStoreServer");
-            Class<?> cacheModeClass = 
Class.forName("org.apache.ignite.cache.CacheMode");
+            // Find the Ignite plugin's classloader
+            ClassLoader igniteClassLoader = null;
+            for (org.pf4j.PluginWrapper plugin : pluginManager.getPlugins()) {
+                if (plugin.getPluginId().contains("ignite") || 
+                    
plugin.getDescriptor().getPluginClass().contains("ignite")) {
+                    igniteClassLoader = plugin.getPluginClassLoader();
+                    LOG.info("Found Ignite plugin: {}", plugin.getPluginId());
+                    break;
+                }
+            }
+            
+            if (igniteClassLoader == null) {
+                LOG.warn("Ignite plugin not found - skipping embedded server 
startup");
+                return;
+            }
+            
+            // Load classes from plugin classloader
+            Class<?> serverClass = 
Class.forName("org.apache.tika.pipes.ignite.server.IgniteStoreServer", 
+                true, igniteClassLoader);
+            Class<?> cacheModeClass = 
Class.forName("org.apache.ignite.cache.CacheMode", 
+                true, igniteClassLoader);
             Object cacheModeEnum = Enum.valueOf((Class<Enum>) cacheModeClass, 
cacheMode);
             
             Object server = serverClass

Reply via email to