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 9674a86229 TIKA-4945: drop ServiceConsumer requirements from 
tika-core's OSGi manifest (#3279)
9674a86229 is described below

commit 9674a8622956aa444e7aa36f2b0c49a29f0d8951
Author: Tim Allison <[email protected]>
AuthorDate: Mon Oct 5 14:56:00 2026 -0400

    TIKA-4945: drop ServiceConsumer requirements from tika-core's OSGi manifest 
(#3279)
---
 CHANGES.txt                                          |  5 +++++
 .../test/java/org/apache/tika/bundle/BundleIT.java   | 18 +++---------------
 .../java/org/apache/tika/config/ServiceLoader.java   | 20 ++++++--------------
 3 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index ee096f0e9b..d00798a75c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -36,6 +36,11 @@ Release 4.2.0 - unreleased
      SERVER/RESOURCE_TIMING) move from INFO to TRACE, and per-fork-start,
      per-connection and plugin lifecycle lines move to DEBUG (TIKA-4949).
 
+   * tika-core's OSGi manifest no longer requires a Service Loader Mediator or
+     providers for Parser, Detector, EncodingDetector, LanguageDetector and
+     MetadataFilter; 4.1.0 failed to install on its own in Equinox/p2
+     (TIKA-4945).
+
 Release 4.1.0 - 9/26/2026
 
   HIGHLIGHTS
diff --git 
a/tika-bundles/tika-bundle-standard/src/test/java/org/apache/tika/bundle/BundleIT.java
 
b/tika-bundles/tika-bundle-standard/src/test/java/org/apache/tika/bundle/BundleIT.java
index 5040280aa5..18b068779f 100644
--- 
a/tika-bundles/tika-bundle-standard/src/test/java/org/apache/tika/bundle/BundleIT.java
+++ 
b/tika-bundles/tika-bundle-standard/src/test/java/org/apache/tika/bundle/BundleIT.java
@@ -73,15 +73,7 @@ public class BundleIT {
                 "org.slf4j.helpers;version=2.0.17",
                 "org.slf4j.spi;version=2.0.17"
         ));
-        config.put("org.osgi.framework.system.capabilities.extra", 
String.join(",",
-                
"osgi.extender;osgi.extender=osgi.serviceloader.processor;version:Version=1.0",
-                
"osgi.extender;osgi.extender=osgi.serviceloader.registrar;version:Version=1.0",
-                
"osgi.serviceloader;osgi.serviceloader=org.apache.tika.detect.Detector",
-                
"osgi.serviceloader;osgi.serviceloader=org.apache.tika.detect.EncodingDetector",
-                
"osgi.serviceloader;osgi.serviceloader=org.apache.tika.language.detect.LanguageDetector",
-                
"osgi.serviceloader;osgi.serviceloader=org.apache.tika.metadata.filter.MetadataFilter",
-                
"osgi.serviceloader;osgi.serviceloader=org.apache.tika.parser.Parser"
-        ));
+        // No Service Loader Mediator capabilities: tika-core must resolve 
without one (TIKA-4945).
 
         FrameworkFactory factory = ServiceLoader.load(FrameworkFactory.class)
                 .iterator().next();
@@ -89,12 +81,8 @@ public class BundleIT {
         framework.start();
         ctx = framework.getBundleContext();
 
-        // Install all bundles first, then start.
-        //
-        // tika-core requires osgi.serviceloader capabilities that are 
provided by tika-bundle-standard,
-        // so both must be installed before either can resolve.
-        //
-        // The test-bundles directory also holds the dependencies of both that 
are OSGi bundles themselves.
+        // Install all bundles first, then start. The test-bundles directory 
also holds the
+        // dependencies of both that are OSGi bundles themselves.
         List<Bundle> bundles = new ArrayList<>();
         try (DirectoryStream<Path> jars = 
Files.newDirectoryStream(TEST_BUNDLES, "*.jar")) {
             for (Path jar : jars) {
diff --git a/tika-core/src/main/java/org/apache/tika/config/ServiceLoader.java 
b/tika-core/src/main/java/org/apache/tika/config/ServiceLoader.java
index 0bd661a445..b1548475ef 100644
--- a/tika-core/src/main/java/org/apache/tika/config/ServiceLoader.java
+++ b/tika-core/src/main/java/org/apache/tika/config/ServiceLoader.java
@@ -34,31 +34,23 @@ import java.util.Map;
 import java.util.Set;
 import java.util.regex.Pattern;
 
-import aQute.bnd.annotation.spi.ServiceConsumer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.tika.detect.Detector;
-import org.apache.tika.detect.EncodingDetector;
 import org.apache.tika.exception.TikaConfigException;
-import org.apache.tika.language.detect.LanguageDetector;
-import org.apache.tika.metadata.filter.MetadataFilter;
-import org.apache.tika.parser.Parser;
 import org.apache.tika.utils.ServiceLoaderUtils;
 
 /**
  * Internal utility class that Tika uses to look up service providers.
- * Supports both static service loading using the {@link ServiceLoader} 
mechanism (and via
- * <a 
href="https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html";>OSGi
 Service Loader Mediator</a>)
- * as well as dynamic loading via OSGi service tracking (from the {@link 
TikaActivator} class).
+ * Supports both static service loading from {@code META-INF/services} as well 
as dynamic
+ * loading via OSGi service tracking (from the {@link TikaActivator} class).
+ * <p>
+ * Static loading reads {@code META-INF/services} itself rather than calling
+ * {@link java.util.ServiceLoader}, so there is nothing for an OSGi Service 
Loader Mediator
+ * processor to weave; this class must not declare {@code @ServiceConsumer} 
requirements.
  *
  * @since Apache Tika 0.9
  */
-@ServiceConsumer(Parser.class)
-@ServiceConsumer(Detector.class)
-@ServiceConsumer(EncodingDetector.class)
-@ServiceConsumer(LanguageDetector.class)
-@ServiceConsumer(MetadataFilter.class)
 public class ServiceLoader {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(ServiceLoader.class);

Reply via email to