-->
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: Hibernate Search: HibernateException: Unable to initialize
PostPosted: Wed Oct 10, 2007 3:54 pm 
Newbie

Joined: Tue Oct 09, 2007 12:07 pm
Posts: 6
Hello,

I am trying to reproduce the first example from Hibernate Search reference, but I stumbled on the org.hibernate.HibernateException: Unable to initialize: index.books.Book

My example looks like the following:
Code:
AnnotationConfiguration cfg = (AnnotationConfiguration) new AnnotationConfiguration()
               .configure();

         sessionFactory = cfg.addPackage("index.books").addAnnotatedClass(
               Book.class).buildSessionFactory(); // fails here
         
         session = sessionFactory.openSession();

         
         FullTextSession fulltextSession = Search
               .createFullTextSession(session);
         Transaction tx = fulltextSession.beginTransaction();
         List<Book> result = session.createCriteria("from Book as book")
               .list();
         for (Book book : result) {
            fulltextSession.index(book);
         }

         tx.commit();


The Book entity is copied and pasted from the tutotial. The debugging does not helped me to realize the problem.

What do I miss here?

Thank you in advance.
Larysa

Exception trace:
Code:
Exception in thread "main" org.hibernate.HibernateException: Unable to initialize: index.books.Book
   at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:147)
   at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:75)
   at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:260)
   at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:94)
   at org.hibernate.search.impl.SearchFactoryImpl.getSearchFactory(SearchFactoryImpl.java:172)
   at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:44)
   at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
   at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
   at index.books.TestHibSearch.main(TestHibSearch.java:24)
Caused by: org.hibernate.search.SearchException: Cannot write into index directory: /var/lucene/indexes
   at org.hibernate.search.util.DirectoryProviderHelper.determineIndexDir(DirectoryProviderHelper.java:86)
   at org.hibernate.search.store.FSDirectoryProvider.initialize(FSDirectoryProvider.java:28)
   at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:144)
   ... 10 more


Top
 Profile  
 
 Post subject: Re: Hibernate Search: HibernateException: Unable to initiali
PostPosted: Thu Oct 11, 2007 5:00 am 
Newbie

Joined: Tue Oct 09, 2007 12:07 pm
Posts: 6
Ok, I solved the problem:

because I am working on Windows platform, the default root for indexes must be specified in the hibernate.cfg.xml as the following:

Code:
<property name="hibernate.search.default.indexBase">
         ./var/lucene/indexes
      </property>


It was just one point ;-)


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.