-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate search error The SearchFactory was not initialized
PostPosted: Wed Apr 22, 2015 8:54 am 
Newbie

Joined: Wed Apr 22, 2015 8:47 am
Posts: 1
I'm trying to use hibernate search. Following this guide http://hibernate.org/search/documentation/getting-started/ I've added this two lines to hibernate.cfg.xml

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


And in the method where will start hibernate session I've put code to sync the search index (as written into the guide).

Code:
// Hibernate starting
    Configuration configuration = new Configuration();
    configuration.configure();
    ServiceRegistry serviceRegistry =
            new StandardServiceRegistryBuilder()
                    .applySettings(
                            configuration.getProperties()
                    ).build();
    // ~Hibernate starting

    SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    Session session = sessionFactory.getCurrentSession();
    FullTextSession fullTextSession = Search.getFullTextSession(session);

    // Close Hibernate session
    try{
        fullTextSession.createIndexer().startAndWait();
        log.info("Hibernate search index created.");
    }catch(InterruptedException e ){
        log.error( "Error during the Sync of Hibernate search on startup.", e );
    }
    try{

        session.getTransaction().commit();

    }catch( Exception ex ){

        try{
            session.getTransaction().rollback();
        }catch( Exception ex2 ){}
        log.error( ex  );

    }finally{
        if( session.isOpen() ){
            session.close();
        }
    }


The problem is that when I start the web-app I receive this error:
Code:
org.apache.catalina.LifecycleException: org.hibernate.search.exception.SearchException: HSEARCH000222: The SearchFactory was not initialized


Please, help me to resolve out this problem, thanks in advance Andrea.


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

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.