简体   繁体   English

找不到Apache Lucene 4.9.0类错误

[英]Apache Lucene 4.9.0 class not found error

i I am using Apache Lucene 4.9 with NetBeans 7.2 for a desktop application. 我将Apache Lucene 4.9与NetBeans 7.2一起用于桌面应用程序。 I have created a standardanalyzer and therefore want to use the the analyzer to create the IndexWriterConfig. 我已经创建了standardanalyzer,因此想使用分析仪来创建IndexWriterConfig。 But he InexWriterConfig gives a class not found error 但他的InexWriterConfig给出了一个类未找到错误

this is the code snippet. 这是代码片段。

// create some index
              StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_4_9);
              System.out.println("index writer to be created1");
              IndexWriterConfig IWConfig = new IndexWriterConfig(Version.LUCENE_4_9,analyzer);

this is the error given by the IDE 这是IDE给出的错误

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/lucene/codecs/sep/IntStreamFactory
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.newInstance0(Class.java:343)
    at java.lang.Class.newInstance(Class.java:325)
    at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:67)
    at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:47)
    at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37)
    at org.apache.lucene.codecs.PostingsFormat.<clinit>(PostingsFormat.java:44)
    at org.apache.lucene.codecs.lucene40.Lucene40Codec.<init>(Lucene40Codec.java:52)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:67)
    at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:47)
    at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37)
    at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:41)
    at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:125)
    at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:171)
    at SearchEngine.Index.createIndexWriter(Index.java:88)
    at SearchEngine.Index.<init>(Index.java:57)
    at SearchEngine.SearchDB.searchDatabase(SearchDB.java:95)
    at wa_poly.MyJFrame.<init>(MyJFrame.java:47)
    at wa_poly.MyJFrame$5.run(MyJFrame.java:292)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.codecs.sep.IntStreamFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 41 more

can anyone help with a solution 任何人都可以提供解决方案的帮助

IntStreamFactory class resides in lucene-codecs-4.9.0.jar , package org.apache.lucene.codecs.sep . IntStreamFactory类位于lucene-codecs-4.9.0.jarorg.apache.lucene.codecs.sep Make sure you have this jar in your classpath. 确保您的类路径中有这个jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM