You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Pulkit Singhal <pu...@gmail.com> on 2011/02/07 18:55:49 UTC

Works on Windows, crashes on Linux

Hello Folks,

I'm using Lucene 3.0, my code runs fine on Windows but when I test it
on Linux, I run into the following stack trace:

java.io.FileNotFoundException:
/opt/apache/tomcat/webapps/myapp/luceneData/backend_IP/en_US/_1.fdt
(No such file or directory)
        at java.io.RandomAccessFile.open(Native Method)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
        at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexOutput.<init>(SimpleFSDirectory.java:180)
        at org.apache.lucene.store.NIOFSDirectory.createOutput(NIOFSDirectory.java:74)
        at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:65)
        at org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:66)
        at org.apache.lucene.index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:144)
        at org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(StoredFieldsWriter.java:193)
        at org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocument(DocumentsWriter.java:1443)
        at org.apache.lucene.index.DocumentsWriter$WaitQueue.add(DocumentsWriter.java:1462)
        at org.apache.lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java:1082)
        at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:776)
        at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:751)
        at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1928)

Things I tried:
1) At first I thought that it had something to do with permissions but
the permissions on the directory where all my indexes are nested and
stored is 755 so I don't see how that could be an issue.
2) Then I realized that l was using Directory directory =
FSDirectory.open(dir) to create the directory that I passed to the
IndexWriter ... and the value of my dir was
...luceneData/backend_IP/en_US/ ... now the two directories
backend_IP/en_US are really placeholders ... the real names are known
to me just before I call FSDirectory.open() ... so I thought that the
problem maybe that in Windows the backend_IP/en_US directories may be
getting created auto-magically by the FSDirectory.open()
implementation ... but in Linux I need to create them manually before
calling FSDirectory.open() ... so I tried that but that didn't help
either.

Now I'm out of clues.

Anyone have any advice?

- Pulkit

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


Re: Works on Windows, crashes on Linux

Posted by Ian Lea <ia...@gmail.com>.
That stack trace appears to be triggered in IndexWriter.addDocument()
rather than .open() which leads one to speculate that the directory is
fine, or was at any rate, but something is messing with the contents.

Evidently you are running this in tomcat - have you got multiple
threads writing to the same index directory at the same time?  Lucene
locking should prevent this - are you bypassing or ignoring locks?


--
Ian.

On Mon, Feb 7, 2011 at 5:55 PM, Pulkit Singhal <pu...@gmail.com> wrote:
> Hello Folks,
>
> I'm using Lucene 3.0, my code runs fine on Windows but when I test it
> on Linux, I run into the following stack trace:
>
> java.io.FileNotFoundException:
> /opt/apache/tomcat/webapps/myapp/luceneData/backend_IP/en_US/_1.fdt
> (No such file or directory)
>        at java.io.RandomAccessFile.open(Native Method)
>        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
>        at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexOutput.<init>(SimpleFSDirectory.java:180)
>        at org.apache.lucene.store.NIOFSDirectory.createOutput(NIOFSDirectory.java:74)
>        at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:65)
>        at org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:66)
>        at org.apache.lucene.index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:144)
>        at org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(StoredFieldsWriter.java:193)
>        at org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocument(DocumentsWriter.java:1443)
>        at org.apache.lucene.index.DocumentsWriter$WaitQueue.add(DocumentsWriter.java:1462)
>        at org.apache.lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java:1082)
>        at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:776)
>        at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:751)
>        at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1928)
>
> Things I tried:
> 1) At first I thought that it had something to do with permissions but
> the permissions on the directory where all my indexes are nested and
> stored is 755 so I don't see how that could be an issue.
> 2) Then I realized that l was using Directory directory =
> FSDirectory.open(dir) to create the directory that I passed to the
> IndexWriter ... and the value of my dir was
> ...luceneData/backend_IP/en_US/ ... now the two directories
> backend_IP/en_US are really placeholders ... the real names are known
> to me just before I call FSDirectory.open() ... so I thought that the
> problem maybe that in Windows the backend_IP/en_US directories may be
> getting created auto-magically by the FSDirectory.open()
> implementation ... but in Linux I need to create them manually before
> calling FSDirectory.open() ... so I tried that but that didn't help
> either.
>
> Now I'm out of clues.
>
> Anyone have any advice?
>
> - Pulkit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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