Robert Munteanu created SLING-12568:
---------------------------------------
Summary: Content extension advertises services for shaded and
relocated packages
Key: SLING-12568
URL: https://issues.apache.org/jira/browse/SLING-12568
Project: Sling
Issue Type: Bug
Components: Feature Model
Affects Versions: Feature Model Content Extension 1.0.0
Reporter: Robert Munteanu
Assignee: Robert Munteanu
Fix For: Feature Model Content Extension 1.0.14
The content extension shades packages from multiple dependencies and relocates
them to prevent classloading conflicts ( SLING-8068 ).
However, it keeps the META-INF/services files around and those are picked up by
the ServiceLoader mechanism. This is incorrect - since the files are not
provided by the jar file so they are pointing to non-existing jar files.
I have observed an instance where the ServiceLoader running in an OSGi bundle
read the META-INF/services file, presumably from the launcher extension, but
failed to load the class. Once I have removed the additional META-INF/services
file from the launcher extension all was solved.
The problem was visible in the XSS bundle, but I assume this would pop up in
any place using the ServiceLoader mechanism.
To make matters confusing, logging on to the Composum browser fixed the
problem, but loading a simple JSP did not help.
{noformat}Caused by: org.apache.felix.log.LogException:
java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory
cannot be created
at
java.xml/javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:319)
... 140 common frames omitted
Caused by: java.util.ServiceConfigurationError:
javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory
not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
at
java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)
at
java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
at
java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
at java.xml/javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:304)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at
java.xml/javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:293)
... 140 common frames omitted{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)