-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: strange IO exception when bulk indexing with hib search
PostPosted: Sun Jan 27, 2008 3:52 am 
Newbie

Joined: Sun Jan 27, 2008 3:36 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.3

Hibernate Search Version: 3.0.0

I'm working on performing a bulk indexing of a number of classes in my domain model using hibernate search. The building of the indexes works nicely, and I can query them, but as soon as I try to build a full index of all the objects in the database for a given class I get the following exception:
Full stack trace of any exception that occurs:

Exception in thread "main" org.hibernate.search.SearchException: Unable to open IndexWriter for class com.myorg.SourceCustomer
at org.hibernate.search.backend.Workspace.getIndexWriter(Workspace.java:135)
at org.hibernate.search.backend.impl.lucene.LuceneWorker.add(LuceneWorker.java:68)
at org.hibernate.search.backend.impl.lucene.LuceneWorker.performWork(LuceneWorker.java:62)
at org.hibernate.search.backend.impl.lucene.LuceneWorker.performWork(LuceneWorker.java:43)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueProcessor.run(LuceneBackendQueueProcessor.java:98)
at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:132)
at org.hibernate.search.backend.impl.TransactionalWorker.performWork(TransactionalWorker.java:48)
at org.hibernate.search.impl.FullTextSessionImpl.index(FullTextSessionImpl.java:140)
at com.myorg.IndexMaintServiceImpl.indexClass(IndexMaintServiceImpl.java:58)
at com.myorg.IndexBuilderMain.main(IndexBuilderMain.java:36)
Caused by: java.io.FileNotFoundException: C:\scnindexes\primary\segments_2ir (Access is denied)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
at org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor.<init>(FSDirectory.java:506)
at org.apache.lucene.store.FSDirectory$FSIndexInput.<init>(FSDirectory.java:536)
at org.apache.lucene.store.FSDirectory$FSIndexInput.<init>(FSDirectory.java:531)
at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:440)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:193)
at org.apache.lucene.index.IndexFileDeleter.<init>(IndexFileDeleter.java:156)
at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:626)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:410)
at org.hibernate.search.backend.Workspace.getIndexWriter(Workspace.java:118)
... 9 more

The code that generates this exception:

Code:
Criteria c = fullTextSession.createCriteria(clazz);
         
         c.setFetchSize(1000);
         
         ScrollableResults results = c.scroll(ScrollMode.FORWARD_ONLY);
         int index = 0;
         int batchSize = 1000;
         System.out.println("Got the list");
         while( results.next() )
         {
            if(index % 5 == 0)
               System.out.print(".");
            if(index % 500 == 0)
               System.out.println(" " + index);
            
            index++;
            fullTextSession.index( results.get(0) );
            if (index % batchSize == 0)
            {
               System.out.println("flushing the session...");
               fullTextSession.clear(); //clear every batchSize since the queue is processed
               fullTextSession.flush();
               
            }
         }


I am able to index between 500 and 1000 objects (though once around 1200) before the above exception occurs. I've played with tuning parameters for the index etc, and nothing seems to help.

If there's anything else I can provide please let me know, but this is what I've been staring at for a while and I'm drawing a blank. Any pointers or things to look at would be greatly appreciated. The code I'm using to perform the bulk index is VERY close to the code in the hibernate search reference docs, but clearly I'm doing something wrong.

Thanks in advance for any assist you can give.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 4:17 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
This might well be a Lucene or better Windows related problem. Have a look at this:

http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200609.mbox/%3C23926652.1158172886168.JavaMail.jira@brutus%3E

Do you have a virus scanner or something similar running on this directory? If you can try switching to a RAMDirectoryProvider in Hibernate Search. If the problem is caused by Windows file locking then it should disappear.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.