Lucene 5.2.1 initialization failed

Description

Getting error when trying to create Lucene 5 java class. Same code works fine in 4.5.2.

Error after first execution:
Message: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: []
StackTrace: lucee.runtime.exp.NativeException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene50' 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$Holder.<clinit>(Codec.java:60) at org.apache.lucene.codecs.Codec.getDefault(Codec.java:140) ...

Error after second execution:
Message: Could not initialize class org.apache.lucene.codecs.Codec$Holder
StackTrace: lucee.runtime.exp.NativeException: Could not initialize class org.apache.lucene.codecs.Codec$Holder at org.apache.lucene.codecs.Codec.getDefault(Codec.java:140) at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:115) at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:163) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ...

Code to reproduce:

Environment

Folowing lucene libraries were added to tomcat common.loader:
lucene-analyzers-common-5.2.1.jar
lucene-core-5.2.1.jar
lucene-facet-5.2.1.jar
lucene-queryparser-5.2.1.jar

Attachments

7

Activity

Michael Offner 
13 July 2016 at 08:26
(edited)

we still see an issue with Lucene 4.1.0:

problems seems to be that:
META-INF/services/org.apache.lucene.codecs.PostingsFormat
is loaded from lucene-codecs-4.1.0 what looks like this:

but does not load from lucene-core-4.1.0 that looks like this:

it is most likely that the wrong "META-INF/services/org.apache.lucene.codecs.PostingsFormat", is loaded, because a code like

leads to the wrong file.

Michael Offner 
12 July 2016 at 12:44

current testcase works with 5.0.1.18 and 5.0.1.21 without defining the jars explicitly.
So it seems we have to extend the testcase.
can you define more details about the difference of your case to the testcase?
https://github.com/lucee/Lucee/blob/master/test/tickets/LDEV0762.cfc
https://github.com/lucee/Lucee/tree/master/test/tickets/LDEV0762

Michael Offner 
12 July 2016 at 11:37

we will extend the testunit so that all jars that are under tests/lib are loaded with the Lucee build that is executed for testing, so we can test better classes loaded by the system classloader.

Michael Offner 
12 July 2016 at 11:30

sees this issue:

Michael Offner 
12 July 2016 at 10:02

testcase only covers testing with a jar defined as part of the createObject call

Problem is that a testcases cannot load jars to classpath, will try to find out if there is a way to do so...

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 25 February 2016 at 14:40
Updated 13 July 2016 at 08:30
Resolved 26 February 2016 at 15:57