Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多线程共享IndexWriter addDocument时报错 #132

Open
GoogleCodeExporter opened this issue Apr 7, 2016 · 1 comment
Open

多线程共享IndexWriter addDocument时报错 #132

GoogleCodeExporter opened this issue Apr 7, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

1.线程中定义共享 IndexWriter 

private static IndexWriter indexWriter = null;

Analyzer analyzer = new org.wltea.analyzer.lucene.IKAnalyzer();
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, analyzer);

indexWriter = new IndexWriter(directory, conf);

2.多线程往 IndexWriter中添加doc时报错(小概率事件)


异常信息:
java.lang.NullPointerException
    at org.wltea.analyzer.Context.lockBuffer(Context.java:96)
    at org.wltea.analyzer.seg.CJKSegmenter.nextLexeme(CJKSegmenter.java:162)
    at org.wltea.analyzer.IKSegmentation.next(IKSegmentation.java:84)
    at org.wltea.analyzer.lucene.IKTokenizer.incrementToken(IKTokenizer.java:51)
    at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:135)
    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:2066)
    at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2040)
    at com.ai.zj.inter.sys.rm.lucene.service.impl.LuceneIndexWriterSVImpl.geneDocuments(LuceneIndexWriterSVImpl.java:170)
    at com.ai.zj.inter.sys.rm.lucene.service.impl.LuceneIndexWriterSVImpl._geneStdAddrLuceneInx(LuceneIndexWriterSVImpl.java:48)
    at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.ai.appframe2.complex.service.proxy.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:110)
    at com.sun.proxy.$Proxy12._geneStdAddrLuceneInx(Unknown Source)
    at com.ai.zj.inter.sys.rm.lucene.task.sv.impl.NewResStdAddrLuceneInxGenerateTask.doTask(NewResStdAddrLuceneInxGenerateTask.java:138)
    at com.asiainfo.appframe.ext.exeframe.task.TaskJob.execute(TaskJob.java:76)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

Original issue reported on code.google.com by [email protected] on 12 Feb 2014 at 9:01

@GoogleCodeExporter
Copy link
Author

麻烦大神 帮忙解决一下!

Original comment by [email protected] on 12 Feb 2014 at 9:02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant