You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Ricardo Lopes <A4...@alunos.ipca.pt> on 2004/11/30 13:07:28 UTC

NullPointerException in IndexSearcher

i have a problem with IndexSearcher, in the following code i get a 
NullPointerException when i try to create an IndexSearcher.
Here is the code:

   private static synchronized Searcher getSearcher( String indexDir ) 
throws IOException
   {
       if( lastModified != IndexReader.lastModified( indexDir ) )
       {
           // there's a new index, open it
           lastModified = IndexReader.lastModified( indexDir );
           searcher = new IndexSearcher( indexDir );   <======== The 
problem is in this line
       }

       return searcher;
   }


for some strange reason the searcher is null, the indexDir variable is 
correctly set to the index directory.

I try to reconstruct the index and i have no problems, but when i try to 
search it i get the same error.
This never happend before, there were no changes in the source code and 
the search always worked, but today i get that error.

There are no permission problems in the index files, all files are owned 
by the same user.
My java version is 1.4.1_02-b06.

Any help would be appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: NullPointerException in IndexSearcher

Posted by Ricardo Lopes <A4...@alunos.ipca.pt>.
Problem solved, it seems that it was some problem with the temporary 
files o tomcat.
Deleting the files from $TOMCAT_DIR/temp solved the problem

Ricardo Lopes wrote:

> i have a problem with IndexSearcher, in the following code i get a 
> NullPointerException when i try to create an IndexSearcher.
> Here is the code:
>
>   private static synchronized Searcher getSearcher( String indexDir ) 
> throws IOException
>   {
>       if( lastModified != IndexReader.lastModified( indexDir ) )
>       {
>           // there's a new index, open it
>           lastModified = IndexReader.lastModified( indexDir );
>           searcher = new IndexSearcher( indexDir );   <======== The 
> problem is in this line
>       }
>
>       return searcher;
>   }
>
>
> for some strange reason the searcher is null, the indexDir variable is 
> correctly set to the index directory.
>
> I try to reconstruct the index and i have no problems, but when i try 
> to search it i get the same error.
> This never happend before, there were no changes in the source code 
> and the search always worked, but today i get that error.
>
> There are no permission problems in the index files, all files are 
> owned by the same user.
> My java version is 1.4.1_02-b06.
>
> Any help would be appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org