|[equinox-dev] OSGi/Equinox and Java SPI|
I am running into some issues with a 3rd party library, and I want to be sure I am correctly understanding the situation. My system is Equinox-based, and I am attempting to introduce a bundle for document processing. That JAR needs to introduce support for character sets which are not included in Java by default. The Charset class uses Java’s SPI pattern (http://java.sun.com/developer/technicalArticles/javase/extensible/index.html) to discover additional Charset implementations at runtime. That JAR has been altered to provide an OSGi manifest, but its META-INF/services/ java.nio.charset.spi.CharsetProvider file remains in its original location.
The issue is that the SPI mechanism fails completely under OSGi/Equinox. When I look at the implementation in java.nio.charset.Charset, it uses the System ClassLoader when trying to find the appropriate resources. Clearly, that doesn’t bode well for interaction with OSGi bundles.
That leaves me with a couple questions:
1) Is the general incompatibility between OSGi/Equinox bundles and SPI a known issue?
2) Is there a workaround I can use to get things working?
+ + + + + + + + + + + + + + + +
Charles River Analytics Inc.
THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.