Robert Munteanu created SLING-11747:
---------------------------------------

             Summary: Unable to override the built-in content package feature 
model extension
                 Key: SLING-11747
                 URL: https://issues.apache.org/jira/browse/SLING-11747
             Project: Sling
          Issue Type: Bug
          Components: Feature Model
    Affects Versions: Feature Model Launcher 1.2.2
            Reporter: Robert Munteanu
             Fix For: Feature Model Launcher 1.2.4


With SLING-10956 we now have an assembly which allows us to drop in additional 
extensions and/or dependencies in the lib directory and have them located by 
the Feature Launcher using the {{ServiceLoader}} mechanism.

That mechanism does not work for the [content 
extension|https://github.com/apache/sling-org-apache-sling-feature-extension-content].
 This extension is special because the handler it provides - 
https://github.com/apache/sling-org-apache-sling-feature-extension-content/blob/master/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
  - is supposed to override the buit-in handler from 
https://github.com/apache/sling-org-apache-sling-feature-launcher/blob/master/src/main/java/org/apache/sling/feature/launcher/impl/extensions/handlers/ContentPackageHandler.java
 .

It seems that the way the classpath is created by the launcher script does not 
allow 'extension' jars to override classes provided by the main jar file. I 
have looked at the [ServiceLoader 
javadoc|https://docs.oracle.com/javase/8/docs/api/index.html?java/util/ServiceLoader.html]
 and it states that    

{quote}When adding providers to the cache, the Iterator processes resources in 
the order that the ClassLoader.getResources(String) method finds the service 
configuration files.{quote}

In practice, I was only able to make the extension override the build-in 
handled by prepending it to the classpath.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to