lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Patramanskij <...@osua.de>
Subject Re: upgrade from Lucene 1.3 final to 1.4rc3 problem
Date Wed, 07 Jul 2004 10:09:09 GMT
Hello Alex.

I had the similar problem when I've upgraded to Lucene 1.4 rc3 from
1.3 final.

After short investigation, I realized that problem is in the
code of constructor FSDirectory() below:

private FSDirectory(File path, boolean create) throws IOException {
 directory = path;
 lockDir = new File(LOCK_DIR);
   if (!lockDir.isAbsolute()) {
     lockDir = new File(directory, LOCK_DIR);
   }
 [...]

 }
The LOCK_DIR constant, deefined as:

public static final String LOCK_DIR =
    System.getProperty("org.apache.lucene.lockdir",
      System.getProperty("java.io.tmpdir", "."));

may have one of the following values :

System.getProperty("org.apache.lucene.lockdir") if it has been set before

System.getProperty("java.io.tmpdir") if it has been set before

"." if no one of above properties specified.

In my case (I'm running Lucene under Tomcat 4.1.27 on WinXp) "java.io.tmpdir"
was set to "..\temp" by Tomcat startup script.

Therefore, the check of lockDir.isAbsolute() returned false and
lockDir was assigned with instance of File(MY_INDEX_DIRECTORY, "..\temp").

Because there was no directory "temp" corresponding to one level above
MY_INDEX_DIRECTORY, method create() threw
NullPointerException when there was a try to access files.length,
because files variable already had null value after calling

files = lockDir.list();



I solved this problem by changing Tomcat startup script the way that
it sets java.io.tmpdir to absolute path.

However, Lucene 1.4 final release is announced by Doug on July, 2 and
available here
http://cvs.apache.org/dist/jakarta/lucene/v1.4-final/

The code for obtaining lockDir location and LOCK_DIR constant has been
changed:

private FSDirectory(File path, boolean create) throws IOException {
 directory = path;
    if (LOCK_DIR == null) {
      lockDir = directory;
    }
    else {
      lockDir = new File(LOCK_DIR);
    }
[...]
}

  public static final String LOCK_DIR =
    System.getProperty("org.apache.lucene.lockdir",
      System.getProperty("java.io.tmpdir"));

The above changes stay that if no one of  "org.apache.lucene.lockdir" or
"java.io.tmpdir" has been set before starting indexing, then lockfile
will be created in the same directory where index files are located.
      
With 1.4 final everything is working just fine for without having to change
Tomcat startup script.


Hope this will help.


Best regards,
 Maxim


Wednesday, July 7, 2004, 7:20:16 AM, you wrote:

AASK> Hi!

AASK> I'm using Lucene 1.3 final currently, all things were working fine.
AASK> But, after i'm upgraded from Lucene 1.3 final to 1.4rc3 (simply overwrite the lucene-1.4-final.jar
to lucene-1.4-rc3.jar and re-compile it)
AASK> We can re-compile it successfuly. but when will try to index the document. It give
the error as below:
AASK> java.lang.NullPointerException
AASK>         at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:146)
AASK>         at org.apache.lucene.store.FSDirectory.<init>(FSDirectory.java:126)
AASK>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:102)
AASK>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
AASK>         at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
AASK> Which wrong? Pls help.

AASK> Thanks.

AASK> Regards,
AASK> Alex


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


Mime
View raw message