Severin Gehwolf created SMX4-1717:
-------------------------------------

             Summary: Lucene 4 bundles are missing META-INF/services files
                 Key: SMX4-1717
                 URL: https://issues.apache.org/jira/browse/SMX4-1717
             Project: ServiceMix 4
          Issue Type: Bug
          Components: Bundles
    Affects Versions: bundles-2014.01
            Reporter: Severin Gehwolf


We are using the servicemix lucene bundles for Thermostat[1]. However, since 
lucene 4 the release JARs use Java's ServiceLoader mechanism for loading 
codecs. Since the META-INF/services files are missing from the servicemix 
lucene bundles any use of IndexWriterConfig will fail with:

Exception in thread "pool-1-thread-1" java.lang.ExceptionInInitializerError
        at 
org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:122)
        at 
org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:165)
Caused by: java.lang.IllegalArgumentException: A SPI class of type 
org.apache.lucene.codecs.Codec with name 'Lucene46' does not exist. You need to 
add the corresponding JAR file supporting this SPI to your classpath.The 
current classpath supports the following names: []
        at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)
        at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
        at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:122)

The fix is to convince the maven-shade plugin to include META-INF/services 
directory in the dep-reduced bundle jar. See:

https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#ServicesResourceTransformer

[1] http://icedtea.classpath.org/thermostat/



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to