Charles Moulliard created SMX4-1637:
---------------------------------------

             Summary: ElasticSearch bundle 0.90.5 does not work as SPI is not 
supported
                 Key: SMX4-1637
                 URL: https://issues.apache.org/jira/browse/SMX4-1637
             Project: ServiceMix 4
          Issue Type: Bug
            Reporter: Charles Moulliard


Existing bundle of SMX - ElasticSearch bundle 0.90.5 does not support SPI 
(Service Locator) and in consequence classes cannot be retrieved :

{code}
Caused by: java.lang.IllegalArgumentException: A SPI class of type 
org.apache.lucene.codecs.PostingsFormat with name 'Memory' does not exist. You 
need to add the corresponding JAR file supporting this SPI to your 
classpath.The current classpath supports the following names: [XBloomFilter, 
es090, completion090, Direct]
        at 
org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)[75:org.apache.servicemix.bundles.elasticsearch:0.90.5.2-SNAPSHOT]
        at 
org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:100)[75:org.apache.servicemix.bundles.elasticsearch:0.90.5.2-SNAPSHOT]
        at 
org.elasticsearch.index.codec.postingsformat.PostingFormats.<clinit>(PostingFormats.java:70)[75:org.apache.servicemix.bundles.elasticsearch:0.90.5.2-SNAPSHOT]
        ... 15 more
{code}

That means that Require and Provide-Capibility must be added to the MANIFEST 
file generated

{code}
                        <Provide-Capability>
                            osgi.serviceloader; 
osgi.serviceloader=org.apache.lucene.codecs.Codec,
                            osgi.serviceloader; 
osgi.serviceloader=org.apache.lucene.codecs.PostingsFormat,
                            osgi.serviceloader; 
osgi.serviceloader=org.apache.lucene.codecs.DocValuesFormat
                        </Provide-Capability>
                        <Require-Capability>
                            osgi.extender; 
filter:="(osgi.extender=osgi.serviceloader.registrar)"
                        </Require-Capability>
{code}

and that the files located under META-INF/Services must be merged.

Remark : As split-package does not work in this situation, the workaround has 
been to add as resources files, the files resulting from the merge between 
classes of lucene-core and elasticsearch

{code}
org.apache.lucene.codecs.Codec
org.apache.lucene.codecs.DocValuesFormat
org.apache.lucene.codecs.PostingsFormat
{coce}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to