문제

I would like to use the PhoneticFilterFactory with ColognePhonetic, but I only get a " java.lang.NoClassDefFoundError:" Any idea what's wrong here?

My Definition for the PhoeneticFilterFactory

@TokenFilterDef(factory = PhoneticFilterFactory.class, params = {
     @Parameter(name = "encoder", value="ColognePhonetic")
     })

And here is the whole Anyalyzer definition:

@AnalyzerDef(name = "customanalyzer", tokenizer =
@TokenizerDef(factory = StandardTokenizerFactory.class), filters = {
  @TokenFilterDef(factory = LowerCaseFilterFactory.class),
  @TokenFilterDef(factory = PhoneticFilterFactory.class, params = {
     @Parameter(name = "encoder", value="ColognePhonetic")
     }),
  @TokenFilterDef(factory = SnowballPorterFilterFactory.class, params = {
    @Parameter(name = "language", value = "German")
  })
})

Error:

ERROR 2013-11-11 14:20:08,010 [LogErrorHandler] HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation: java.lang.NoClassDefFoundError: org/apache/commons/codec/Encoder
   at org.apache.lucene.analysis.phonetic.PhoneticFilter.incrementToken(PhoneticFilter.java:64)
   at org.apache.lucene.analysis.snowball.SnowballFilter.incrementToken(SnowballFilter.java:76)
   at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:146)
   at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:278)
   at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:766)
   at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2060)
   at org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate.performWork(AddWorkDelegate.java:71)
   at org.hibernate.search.backend.impl.lucene.LuceneBackendTaskStreamer.doWork(LuceneBackendTaskStreamer.java:66)
   at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueProcessor.applyStreamWork(LuceneBackendQueueProcessor.java:83)
   at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.performStreamOperation(DirectoryBasedIndexManager.java:121)
   at org.hibernate.search.backend.impl.StreamingSelectionVisitor$AddSelectionDelegate.performStreamOperation(StreamingSelectionVisitor.java:99)
   at org.hibernate.search.backend.impl.batch.DefaultBatchBackend.sendWorkToShards(DefaultBatchBackend.java:75)
   at org.hibernate.search.backend.impl.batch.DefaultBatchBackend.enqueueAsyncWork(DefaultBatchBackend.java:62)
   at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.index(EntityConsumerLuceneWorkProducer.java:210)
   at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.indexAllQueue(EntityConsumerLuceneWorkProducer.java:138)
   at org.hibernate.search.batchindexing.impl.EntityConsumerLuceneWorkProducer.run(EntityConsumerLuceneWorkProducer.java:106)
   at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:89)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:722)

Using Hibernate Search 4.4.0 Final with Hibernate Core {4.1.6.Final} on JBoss AS 7.1.3.Final

도움이 되었습니까?

해결책 2

Problem is solved by help from Gunnar from the hibernate team. (https://forum.hibernate.org/viewtopic.php?f=9&t=1029612)

The solution was to copy the commons-codec-1.8.jar to the module folde of apache lucene in my jboss installation (JBOSS_HOME/modules/org/apache/lucene/3.6.2) and make an entry in the module.xml.

After that the phoneticfilterfactory, especially the colognephonetic, was found and my indexing is working.

Thanks to everyone who has helped.

다른 팁

It looks like the Apache Commons Codec library is missing in your classpath. If you take a look on the dependency tree of Hibernate Search 4.4.0.Final, you will see that there is an transitive dependency to commons-codec 1.6:

hibernate-search:4.4.0.Final
- hibernate-search-orm:4.4.0.Final
  - hibernate-search-analyzers:4.4.0.Final
    - solr-analysis-extras:3.6.2
      - solr-core:3.6.2
        - commons-codec:1.6
        - lucene-phonetic:3.6.2
          - commons-codec:1.6

So adding commons-codec to your classpath should at least solve the NoClassDefFoundError.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top