Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings

Compass Support Forums » Compass » Compass Users

Thread: Could not initialize class org.apache.lucene.index.SegmentReader

This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Permlink Replies: 1 - Pages: 1 - Last Post: Aug 29, 2008 2:50 PM Last Post By: Shay Banon

Posts: 11
Registered: 4/25/07
Could not initialize class org.apache.lucene.index.SegmentReader
Posted: Aug 29, 2008 5:43 AM
  Click to reply to this thread Reply
I get this exception when trying to do anything that requires updating the index.

Compass Version: 2.0.2
Lucene-Core Version: 2.3.2


[ERROR] TransactionSynchronizationUtils - TransactionSynchronization.afterCompletion threw exception <java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.index.SegmentReader>java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.index.SegmentReader
        at org.apache.lucene.index.DirectoryIndexReader$1.doBody(
        at org.apache.lucene.index.SegmentInfos$
        at org.compass.core.lucene.engine.manager.LuceneIndexHolder.<init>(
        at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.internalRefreshCache(
        at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.refreshCache(
        at org.compass.core.lucene.engine.transaction.lucene.LuceneTransaction$
        at org.compass.core.transaction.context.TransactionalCallable$1.doInTransaction(
        at org.compass.core.impl.DefaultCompass$CompassTransactionContext.execute(
        at org.compass.core.executor.DefaultExecutorManager.invokeAllWithLimit(
        at org.compass.core.executor.DefaultExecutorManager.invokeAllWithLimitBailOnException(
        at org.compass.core.lucene.engine.transaction.lucene.LuceneTransaction.doCommit(
        at org.compass.core.lucene.engine.transaction.AbstractTransaction.commit(
        at org.compass.core.lucene.engine.LuceneSearchEngine.commit(
        at org.compass.spring.transaction.SpringSyncTransaction$SpringTransactionSynchronization.afterCompletion(
        at org.compass.spring.transaction.SpringSyncTransaction.doCommit(
        at org.compass.core.transaction.AbstractTransaction.commit(
        at org.compass.core.CompassTemplate.execute(
        at org.compass.gps.impl.SingleCompassGps.executeForIndex(
        at java.util.concurrent.FutureTask$Sync.innerRun(
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
        at java.util.concurrent.ThreadPoolExecutor$

I was hoping you might have an idea what is going wrong here. I placed the libraries in the WEB-INF/lib directory.
There is another application on the server which is using compass also. (compass-1.2M2 with lucene-core 2.2.0)
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Could not initialize class org.apache.lucene.index.SegmentReader
Posted: Aug 29, 2008 2:50 PM   in response to: Thunderstorm in response to: Thunderstorm
  Click to reply to this thread Reply
This is problematic as Compass 1.2 sets a system property (Lucene way to configure SegmentReader) to set its own SegmentReader. In Compass 2.0, there is no need for that anymore, but when the application that uses 2.0 loads up, it fails since it can't find the CompassSegmentReader in the classpath.

I guess you have two options:

1. Don't run them in the same JVM...
2. Extract the CompassSegmentReader class, and add it to the application that uses Compass 2.0. It won't affect Compass 2.0 at all.
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums