Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 85350 invoked from network); 4 Aug 2006 09:19:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2006 09:19:55 -0000 Received: (qmail 892 invoked by uid 500); 4 Aug 2006 09:19:52 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 857 invoked by uid 500); 4 Aug 2006 09:19:51 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 846 invoked by uid 99); 4 Aug 2006 09:19:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 02:19:51 -0700 X-ASF-Spam-Status: No, hits=1.6 required=10.0 tests=DEAR_SOMETHING X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 02:19:51 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4157841000F for ; Fri, 4 Aug 2006 09:17:15 +0000 (GMT) Message-ID: <23089190.1154683035264.JavaMail.jira@brutus> Date: Fri, 4 Aug 2006 02:17:15 -0700 (PDT) From: "Simon Willnauer (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-647) Error when tried to index with IndexWriter on Luncene 2.0 In-Reply-To: <26878248.1154675893971.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/LUCENE-647?page=comments#action_12425707 ] Simon Willnauer commented on LUCENE-647: ---------------------------------------- Hi Sherin, Your exception is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable. So the cause of the exception would be much more interesting than the top stack trace. Caused by: java.lang.NullPointerException at org.apache.lucene.analysis.standard.StandardFilter.(StandardFilter.java:32) ... 21 more Could you provide the rest of the stacktrace from the stdout of your server?! Did you build your lucene distr. on your own, or did you use the binary dist? regards simon > Error when tried to index with IndexWriter on Luncene 2.0 > --------------------------------------------------------- > > Key: LUCENE-647 > URL: http://issues.apache.org/jira/browse/LUCENE-647 > Project: Lucene - Java > Issue Type: Bug > Affects Versions: 2.0.0 > Environment: Windows 2000/ Jdk 1.4 > Reporter: sherin george > > Dear Sir, > I am getting the following runtime exception when I tried to integrate Lucene 2.0 with my java application. > 500 Internal Server Error > java.lang.ExceptionInInitializerError: java.lang.NullPointerException > at org.apache.lucene.analysis.standard.StandardAnalyzer.tokenStream(StandardAnalyzer.java:72) > at org.apache.lucene.index.DocumentWriter.invertDocument(DocumentWriter.java:162) > at org.apache.lucene.index.DocumentWriter.addDocument(DocumentWriter.java:93) > at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:476) > at com.kms.utils.IndexFiles.addToIndex(IndexFiles.java:84) > at com.kms.document.action.DocumentUploadSubmitAction.execute(DocumentUploadSubmitAction.java:180) > at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) > at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) > at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) > at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) > at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) > at java.lang.Thread.run(Thread.java:536) > Caused by: java.lang.NullPointerException > at org.apache.lucene.analysis.standard.StandardFilter.(StandardFilter.java:32) > ... 21 more > I have identified that the exception occurs at execution of the following line of code which indexes a document. > package com.kms.utils; > import com.kms.parser.Parser; > import com.kms.parser.ParserFactory; > import com.kms.reuse.Constants; > import org.apache.lucene.search.Hits; > import org.apache.lucene.search.Query; > import org.apache.lucene.queryParser.QueryParser; > import org.apache.lucene.analysis.standard.StandardAnalyzer; > import org.apache.lucene.document.Document; > import org.apache.lucene.document.Field; > import org.apache.lucene.index.IndexWriter; > import org.apache.lucene.store.FSDirectory; > import org.apache.lucene.search.IndexSearcher; > import org.apache.lucene.analysis.Analyzer; > import org.apache.lucene.store.Directory; > import org.apache.lucene.demo.FileDocument; > import java.io.*; > public class IndexFiles > { > public static void addToIndex(String fileName) > { > try > { > Analyzer analyzer = new StandardAnalyzer(); > String filePath="D:\docs"; //Folder to files are save > String filePathName=filePath+"/"+fileName; > Directory directory = FSDirectory.getDirectory("D: \index",true); "; > //Folder to which index files are saved > Document doc = new Document(); > File file = new File(filePathName); > Parser parser = ParserFactory.getParser(file); > StringBuffer content = null; > String name = ""; > String author = ""; > String sourceDate = ""; > String keywords = ""; > if (parser != null) > { > content = parser.getContent(); > name = parser.getTitle(); > author = parser.getAuthor(); > sourceDate = parser.getSourceDate(); > keywords = parser.getKeywords(); > } > doc.add(new Field("path",filePathName, Field.Store.YES,Field.Index.TOKENIZED)); > doc.add(new Field("name",fileName,Field.Store.YES,Field.Index.TOKENIZED)); > doc.add(new Field("contents",content.toString(),Field.Store.YES,Field.Index.TOKENIZED)); > boolean flag=true; > File indexFiles=new File("D: \index"); > String[] fileList=indexFiles.list(); > if(fileList.length>1) > { > flag=false; > } > else > { > flag=true; > } > IndexWriter iwriter = new IndexWriter(directory,analyzer,flag); > iwriter.setMaxFieldLength(25000); > iwriter.addDocument(doc,analyzer); > iwriter.close(); > } > catch(Exception e) > { > System.out.println(e); > } > } > } > I have checked all objects like directory,doc and analayzer for null conditions but they all have specific values. I have even tried to execute the sample code provided with the javadoc API documentation but in vain. > Any kind of solutions (including pseudo codes) are welcome > Thanks in advance, > Sherin George -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org