karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siano, Stephan" <stephan.si...@sap.com>
Subject RE: org.apache.karaf.specs.locator on Karaf 4.2.1
Date Thu, 06 Sep 2018 14:05:39 GMT

I am using JDK 8 (and a custom karaf distribution). However it should not be so difficult
to reproduce:
1. Install Woodstox on the system (e.g. mvn:org.codehaus.woodstox/stax2-api/3.1.4 and mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1)
(I am aware that these are not the latest version, but that should actually not matter) What
does matter is that the woodstox-core-asl bundle contains a directory META-INF/services with
files like javax.xml.stream.XMLInputFactory containing the class name of the factory implementation
provided by this bundle.
2. set a set of system properties
when you restart your karaf. The system property and the value should match name and the content
of the files in META-INF/services of the woodstox bundle. Note: for the operation of the feature
to look up the factory this is not necessary, but if you don't set these properties, the lookup
in the next step will just return the JDK implementation of the factory, which might work
but is not desired in this case.
3. have another bundle that does not import the Woodstox implementation packages (only javax.xml.stream).
 Call the static method javax.xml.stream.XMLInputFactory.newFactory() from this bundle. This
should give you an instance of the com.ctc.wstx.stax.WstxInputFactory (when woodstox is installed).

Best regards

-----Original Message-----
From: Freeman Fang <freeman.fang@gmail.com> 
Sent: Donnerstag, 6. September 2018 15:44
To: dev@karaf.apache.org
Subject: Re: org.apache.karaf.specs.locator on Karaf 4.2.1

Hi Stephan,

What’s the JDK version you are using?
And could you please tell me the steps to reproduce this error?

I want to reproduce it and take a close look.


Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat

> On Sep 6, 2018, at 8:14 PM, Siano, Stephan <stephan.siano@sap.com> wrote:
> Hi,
> with Karaf 4.2.0 Guillaume Nodet introduced some mechanism around the org.apache.karaf.specs.activator
bundle that allowed the lookup of registered service implementations (like woodstox for the
Stax-API) in Karaf 4.2.0.
> With 4.2.1 the jar is gone from the boot classpath (with two commits with Freeman Fang
that say "ensure Karaf can build and run with JDK11/JDK10").
> So with Karaf 4.2.1 the lookup for the Woodstox does not work anymore (probably because
of that).
> Caused by: javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxInputFactory
not found
>        at javax.xml.stream.$FactoryFinder.newInstance($FactoryFinder.java:97)
>        at javax.xml.stream.$FactoryFinder.newInstance($FactoryFinder.java:74)
>        at javax.xml.stream.$FactoryFinder.find($FactoryFinder.java:129)
>        at javax.xml.stream.$FactoryFinder.find($FactoryFinder.java:106)
>        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:52)
>        at javax.xml.stream.XMLInputFactory.newFactory(XMLInputFactory.java:57)
>        at ...
>        ... 1 common frames omitted
> Caused by: java.lang.ClassNotFoundException: com/ctc/wstx/stax/WstxInputFactory
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forNameFW(Class.java:357)
>        at java.lang.Class.forName(Class.java:350)
>        at javax.xml.stream.$FactoryFinder.getProviderClass($FactoryFinder.java:64)
>        at javax.xml.stream.$FactoryFinder.newInstance($FactoryFinder.java:87)
>        ... 12 common frames omitted
> Was that bundle removed on purpose from the boot classpath, or was this just an accident?
Other bundles related to this are still there (except org.apache.karaf.specs.java.xml.ws which
was removed from the lib/endorsed directory).
> Best regards
> Stephan

View raw message